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

PixelPaint: Save layer mask when adding to the UndoStack

This makes undoing actions performed on layer masks work as
expected.

did_modify_bitmap() is now also called on redo, to ensure the layer
mask is displayed correctly.
This commit is contained in:
Tim Ledbetter 2023-02-14 23:35:10 +00:00 committed by Andreas Kling
parent 34567bc145
commit f1a792e6c9
2 changed files with 5 additions and 0 deletions

View file

@ -41,6 +41,10 @@ ErrorOr<NonnullRefPtr<Layer>> Layer::create_snapshot(Image& image, Layer const&
{
auto bitmap = TRY(layer.content_bitmap().clone());
auto snapshot = TRY(create_with_bitmap(image, move(bitmap), layer.name()));
if (layer.is_masked()) {
snapshot->m_mask_bitmap = TRY(layer.mask_bitmap()->clone());
snapshot->m_edit_mode = layer.m_edit_mode;
}
/*
We set these properties directly because calling the setters might