1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:37:45 +00:00

PixelPaint: Have layers and images send out notifications on changes

We use this to automatically update the thumbnail in LayerListWidget
when you draw into a layer. We also use it to repaint the ImageEditor
when the image changes somehow. :^)
This commit is contained in:
Andreas Kling 2020-05-25 22:49:50 +02:00
parent de85cd0907
commit dc3de47b03
14 changed files with 53 additions and 12 deletions

View file

@ -59,7 +59,7 @@ void EraseTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve
Gfx::Rect r = build_rect(event.position(), layer.rect());
GUI::Painter painter(layer.bitmap());
painter.clear_rect(r, get_color());
m_editor->update();
layer.did_modify_bitmap(*m_editor->image());
}
void EraseTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent&)
@ -68,7 +68,7 @@ void EraseTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve
Gfx::Rect r = build_rect(event.position(), layer.rect());
GUI::Painter painter(layer.bitmap());
painter.clear_rect(r, get_color());
m_editor->update();
layer.did_modify_bitmap(*m_editor->image());
}
}