1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

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

Another one that was used in a fajillion places.
This commit is contained in:
Andreas Kling 2021-11-06 19:30:59 +01:00
parent 235f39e449
commit 0de33b3d6c
Notes: sideshowbarker 2024-07-18 01:24:23 +09:00
43 changed files with 157 additions and 141 deletions

View file

@ -241,9 +241,10 @@ static bool load_ico_bmp(ICOLoadingContext& context, ICOImageDescriptor& desc)
return false;
}
desc.bitmap = Bitmap::try_create(BitmapFormat::BGRA8888, { desc.width, desc.height });
if (!desc.bitmap)
auto bitmap_or_error = Bitmap::try_create(BitmapFormat::BGRA8888, { desc.width, desc.height });
if (bitmap_or_error.is_error())
return false;
desc.bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
Bitmap& bitmap = *desc.bitmap;
const u8* image_base = context.data + desc.offset + sizeof(info);
const BMP_ARGB* data_base = (const BMP_ARGB*)image_base;