mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
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.
This commit is contained in:
parent
8c81d195c7
commit
854e16797e
3 changed files with 4 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue