mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:47:45 +00:00
LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
This commit is contained in:
parent
f0409081f5
commit
c7d891765c
131 changed files with 422 additions and 421 deletions
|
@ -606,7 +606,7 @@ static bool decode_png_bitmap_simple(PNGLoadingContext& context)
|
|||
}
|
||||
}
|
||||
|
||||
context.bitmap = Bitmap::create_purgeable(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height });
|
||||
context.bitmap = Bitmap::try_create_purgeable(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height });
|
||||
|
||||
if (!context.bitmap) {
|
||||
context.state = PNGLoadingContext::State::Error;
|
||||
|
@ -708,7 +708,7 @@ static bool decode_adam7_pass(PNGLoadingContext& context, Streamer& streamer, in
|
|||
}
|
||||
}
|
||||
|
||||
subimage_context.bitmap = Bitmap::create(context.bitmap->format(), { subimage_context.width, subimage_context.height });
|
||||
subimage_context.bitmap = Bitmap::try_create(context.bitmap->format(), { subimage_context.width, subimage_context.height });
|
||||
if (!unfilter(subimage_context)) {
|
||||
subimage_context.bitmap = nullptr;
|
||||
return false;
|
||||
|
@ -726,7 +726,7 @@ static bool decode_adam7_pass(PNGLoadingContext& context, Streamer& streamer, in
|
|||
static bool decode_png_adam7(PNGLoadingContext& context)
|
||||
{
|
||||
Streamer streamer(context.decompression_buffer->data(), context.decompression_buffer->size());
|
||||
context.bitmap = Bitmap::create_purgeable(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height });
|
||||
context.bitmap = Bitmap::try_create_purgeable(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height });
|
||||
if (!context.bitmap)
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue