1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:27:43 +00:00

LibGfx: Use ErrorOr<T> for Bitmap::flipped()

This commit is contained in:
Andreas Kling 2021-11-06 11:58:00 +01:00
parent 69c4614a94
commit db90b4554e
4 changed files with 9 additions and 8 deletions

View file

@ -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