mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibGfx: Use ErrorOr<T> for Bitmap::rotated()
This commit is contained in:
parent
2da4cfcc80
commit
69c4614a94
Notes:
sideshowbarker
2024-07-18 01:24:44 +09:00
Author: https://github.com/awesomekling
Commit: 69c4614a94
5 changed files with 11 additions and 10 deletions
|
@ -347,11 +347,13 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::clone() const
|
|||
return new_bitmap.release_nonnull();
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap> Bitmap::rotated(Gfx::RotationDirection rotation_direction) const
|
||||
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::rotated(Gfx::RotationDirection rotation_direction) const
|
||||
{
|
||||
auto new_bitmap = Gfx::Bitmap::try_create(this->format(), { height(), width() }, 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();
|
||||
|
@ -367,7 +369,7 @@ RefPtr<Gfx::Bitmap> Bitmap::rotated(Gfx::RotationDirection rotation_direction) c
|
|||
}
|
||||
}
|
||||
|
||||
return new_bitmap;
|
||||
return new_bitmap.release_nonnull();
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap> Bitmap::flipped(Gfx::Orientation orientation) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue