diff options
author | Marcus Nilsson <brainbomb@gmail.com> | 2021-08-07 23:37:13 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-08 13:55:39 +0200 |
commit | 854e16797ee9b7e5f60bc93cf2ee6cd39825ddab (patch) | |
tree | 9ce742ce09eed29d5e5804638e7c03114e874317 /Userland/Applications | |
parent | 8c81d195c7e8cc9a2835d37c9b1ff264aa3d39b6 (diff) | |
download | serenity-854e16797ee9b7e5f60bc93cf2ee6cd39825ddab.zip |
PixelPaint: Tighten update rects for Tools
This tightens the update rects for EraseTool, BrushTool And the marching
ants update in Selection. Inflate Selection update rect by 10x10 to
avoid misalignment when zoomed out.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/PixelPaint/BrushTool.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/EraseTool.cpp | 4 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/Selection.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Applications/PixelPaint/BrushTool.cpp b/Userland/Applications/PixelPaint/BrushTool.cpp index dad399c880..ca1d754988 100644 --- a/Userland/Applications/PixelPaint/BrushTool.cpp +++ b/Userland/Applications/PixelPaint/BrushTool.cpp @@ -35,7 +35,7 @@ void BrushTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve for (int i = 0; i < first_draw_opacity; ++i) draw_point(layer.bitmap(), m_editor->color_for(event), event.position()); - layer.did_modify_bitmap(); + layer.did_modify_bitmap(Gfx::IntRect::centered_on(event.position(), Gfx::IntSize { m_size * 2, m_size * 2 })); m_last_position = event.position(); } diff --git a/Userland/Applications/PixelPaint/EraseTool.cpp b/Userland/Applications/PixelPaint/EraseTool.cpp index 90a6292d4b..715db37ff7 100644 --- a/Userland/Applications/PixelPaint/EraseTool.cpp +++ b/Userland/Applications/PixelPaint/EraseTool.cpp @@ -42,7 +42,7 @@ void EraseTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve Gfx::IntRect r = build_rect(event.position(), layer.rect()); GUI::Painter painter(layer.bitmap()); painter.clear_rect(r, get_color()); - layer.did_modify_bitmap(); + layer.did_modify_bitmap(r.inflated(2, 2)); } void EraseTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent&) @@ -51,7 +51,7 @@ void EraseTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve Gfx::IntRect r = build_rect(event.position(), layer.rect()); GUI::Painter painter(layer.bitmap()); painter.clear_rect(r, get_color()); - layer.did_modify_bitmap(); + layer.did_modify_bitmap(r.inflated(2, 2)); } } diff --git a/Userland/Applications/PixelPaint/Selection.cpp b/Userland/Applications/PixelPaint/Selection.cpp index dc1e9e0838..7d591c6a84 100644 --- a/Userland/Applications/PixelPaint/Selection.cpp +++ b/Userland/Applications/PixelPaint/Selection.cpp @@ -24,7 +24,7 @@ Selection::Selection(ImageEditor& editor) ++m_marching_ants_offset; m_marching_ants_offset %= (marching_ant_length * 2); if (!is_empty() || m_in_interactive_selection) - m_editor.update(); + m_editor.update(m_editor.image_rect_to_editor_rect(bounding_rect().inflated(10, 10)).to_type<int>()); }); m_marching_ants_timer->start(); } |