mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-26 03:02:27 -05: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
Notes:
sideshowbarker
2024-07-18 20:47:31 +09:00
Author: https://github.com/mrkct Commit: https://github.com/SerenityOS/serenity/commit/1e912fb5a18 Pull-request: https://github.com/SerenityOS/serenity/pull/6110 Reviewed-by: https://github.com/awesomekling
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
Reference in a new issue