1
Fork 0
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:
Andreas Kling 2021-11-06 11:23:37 +01:00
parent c6b4e7a2f6
commit f23f99d51b
5 changed files with 22 additions and 15 deletions

View file

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