From 854e16797ee9b7e5f60bc93cf2ee6cd39825ddab Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Sat, 7 Aug 2021 23:37:13 +0200 Subject: 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. --- Userland/Applications/PixelPaint/BrushTool.cpp | 2 +- Userland/Applications/PixelPaint/EraseTool.cpp | 4 ++-- Userland/Applications/PixelPaint/Selection.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'Userland/Applications') 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()); }); m_marching_ants_timer->start(); } -- cgit v1.2.3