mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
PixelPaint: Add layer to image before setting properties
Previously when opening an image with layers that had properties like visibility set, PixelPaint would crash when trying to trigger layer_did_modify_properties() without in image. Avoid this by adding the layer to the image before setting the properties.
This commit is contained in:
parent
dd3996e207
commit
54d4df668a
Notes:
sideshowbarker
2024-07-18 11:06:56 +09:00
Author: https://github.com/metmo Commit: https://github.com/SerenityOS/serenity/commit/54d4df668aa Pull-request: https://github.com/SerenityOS/serenity/pull/8376
|
@ -125,12 +125,12 @@ Result<NonnullRefPtr<Image>, String> Image::try_create_from_pixel_paint_file(Str
|
|||
if (width != layer->size().width() || height != layer->size().height())
|
||||
return String { "Decoded layer bitmap has wrong size"sv };
|
||||
|
||||
image->add_layer(*layer);
|
||||
|
||||
layer->set_location({ layer_object.get("locationx").to_i32(), layer_object.get("locationy").to_i32() });
|
||||
layer->set_opacity_percent(layer_object.get("opacity_percent").to_i32());
|
||||
layer->set_visible(layer_object.get("visible").as_bool());
|
||||
layer->set_selected(layer_object.get("selected").as_bool());
|
||||
|
||||
image->add_layer(*layer);
|
||||
}
|
||||
|
||||
image->set_path(file_path);
|
||||
|
|
Loading…
Reference in a new issue