mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
LibGfx: Use ErrorOr<T> for Bitmap::try_create_with_anonymous_buffer()
This commit is contained in:
parent
c6b4e7a2f6
commit
f23f99d51b
5 changed files with 22 additions and 15 deletions
|
@ -869,13 +869,13 @@ OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size
|
|||
}
|
||||
|
||||
// FIXME: Plumb scale factor here eventually.
|
||||
auto bitmap = Gfx::Bitmap::try_create_with_anonymous_buffer(format, buffer_or_error.release_value(), size, 1, {});
|
||||
if (!bitmap) {
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_create_with_anonymous_buffer(format, buffer_or_error.release_value(), size, 1, {});
|
||||
if (bitmap_or_error.is_error()) {
|
||||
VERIFY(size.width() <= INT16_MAX);
|
||||
VERIFY(size.height() <= INT16_MAX);
|
||||
return {};
|
||||
}
|
||||
return make<WindowBackingStore>(bitmap.release_nonnull());
|
||||
return make<WindowBackingStore>(bitmap_or_error.release_value());
|
||||
}
|
||||
|
||||
void Window::set_modal(bool modal)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue