mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
PixelPaint: Avoid notifying image when creating a layer's snapshot
This fixes a bug where the application would crash if the user changed the default values for opacity or visibility of a layer and then tried to draw on it.
This commit is contained in:
parent
e8d2d73d55
commit
1e912fb5a1
1 changed files with 9 additions and 2 deletions
|
@ -55,10 +55,17 @@ RefPtr<Layer> Layer::create_with_bitmap(Image& image, const Gfx::Bitmap& bitmap,
|
|||
RefPtr<Layer> Layer::create_snapshot(Image& image, const Layer& layer)
|
||||
{
|
||||
auto snapshot = create_with_bitmap(image, *layer.bitmap().clone(), layer.name());
|
||||
snapshot->set_opacity_percent(layer.opacity_percent());
|
||||
snapshot->set_visible(layer.is_visible());
|
||||
/*
|
||||
We set these properties directly because calling the setters might
|
||||
notify the image of an update on the newly created layer, but this
|
||||
layer has not yet been added to the image.
|
||||
*/
|
||||
snapshot->m_opacity_percent = layer.opacity_percent();
|
||||
snapshot->m_visible = layer.is_visible();
|
||||
|
||||
snapshot->set_selected(layer.is_selected());
|
||||
snapshot->set_location(layer.location());
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue