mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47: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:
parent
de85cd0907
commit
dc3de47b03
14 changed files with 53 additions and 12 deletions
|
@ -48,7 +48,7 @@ void PenTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent
|
|||
|
||||
GUI::Painter painter(layer.bitmap());
|
||||
painter.draw_line(event.position(), event.position(), m_editor->color_for(event), m_thickness);
|
||||
m_editor->update();
|
||||
layer.did_modify_bitmap(*m_editor->image());
|
||||
m_last_drawing_event_position = event.position();
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ void PenTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent
|
|||
painter.draw_line(m_last_drawing_event_position, event.position(), m_editor->color_for(event), m_thickness);
|
||||
else
|
||||
painter.draw_line(event.position(), event.position(), m_editor->color_for(event), m_thickness);
|
||||
m_editor->update();
|
||||
layer.did_modify_bitmap(*m_editor->image());
|
||||
|
||||
m_last_drawing_event_position = event.position();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue