diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-06 11:58:00 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-08 00:35:27 +0100 |
commit | db90b4554ec18e60c1435cc81d379a6afbd2a1fe (patch) | |
tree | de3e056e3ffe1260ff2e26fd2d162bc722f50eda /Userland/Libraries/LibGfx/Bitmap.cpp | |
parent | 69c4614a9437b344cd6f157e0fb7150f3fbd4551 (diff) | |
download | serenity-db90b4554ec18e60c1435cc81d379a6afbd2a1fe.zip |
LibGfx: Use ErrorOr<T> for Bitmap::flipped()
Diffstat (limited to 'Userland/Libraries/LibGfx/Bitmap.cpp')
-rw-r--r-- | Userland/Libraries/LibGfx/Bitmap.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index eb08fc8880..ac198aed3f 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -372,11 +372,13 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::rotated(Gfx::RotationDirection rotat return new_bitmap.release_nonnull(); } -RefPtr<Gfx::Bitmap> Bitmap::flipped(Gfx::Orientation orientation) const +ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::flipped(Gfx::Orientation orientation) const { auto new_bitmap = Gfx::Bitmap::try_create(this->format(), { width(), height() }, scale()); - if (!new_bitmap) - return nullptr; + if (!new_bitmap) { + // FIXME: Propagate the *real* error, once we have it. + return Error::from_errno(ENOMEM); + } auto w = this->physical_width(); auto h = this->physical_height(); @@ -390,7 +392,7 @@ RefPtr<Gfx::Bitmap> Bitmap::flipped(Gfx::Orientation orientation) const } } - return new_bitmap; + return new_bitmap.release_nonnull(); } RefPtr<Gfx::Bitmap> Bitmap::scaled(int sx, int sy) const |