1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:07:34 +00:00

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

This commit is contained in:
Andreas Kling 2021-11-06 11:52:35 +01:00
parent c417820bff
commit 2da4cfcc80
6 changed files with 23 additions and 11 deletions

View file

@ -39,7 +39,11 @@ RefPtr<Layer> Layer::try_create_with_bitmap(Image& image, NonnullRefPtr<Gfx::Bit
RefPtr<Layer> Layer::try_create_snapshot(Image& image, Layer const& layer)
{
auto snapshot = try_create_with_bitmap(image, *layer.bitmap().clone(), layer.name());
auto new_bitmap_or_error = layer.bitmap().clone();
if (new_bitmap_or_error.is_error())
return nullptr;
auto snapshot = try_create_with_bitmap(image, new_bitmap_or_error.release_value_but_fixme_should_propagate_errors(), layer.name());
/*
We set these properties directly because calling the setters might
notify the image of an update on the newly created layer, but this