mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
PixelPaint: Inflate update rect for PenTool
Previously using PenTool while zoomed in could cause rendering glitches since the update rect was misaligned with the image, most likely because of rounding errors. Loosening the rect with 1 pixel on either side takes care of this.
This commit is contained in:
parent
99dfab08c9
commit
8c81d195c7
Notes:
sideshowbarker
2024-07-18 07:14:57 +09:00
Author: https://github.com/metmo Commit: https://github.com/SerenityOS/serenity/commit/8c81d195c7e Pull-request: https://github.com/SerenityOS/serenity/pull/9283
1 changed files with 2 additions and 2 deletions
|
@ -31,7 +31,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);
|
||||
layer.did_modify_bitmap(Gfx::IntRect::centered_on(event.position(), Gfx::IntSize { m_thickness, m_thickness }));
|
||||
layer.did_modify_bitmap(Gfx::IntRect::centered_on(event.position(), Gfx::IntSize { m_thickness + 2, m_thickness + 2 }));
|
||||
m_last_drawing_event_position = event.position();
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ void PenTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent
|
|||
painter.draw_line(event.position(), event.position(), m_editor->color_for(event), m_thickness);
|
||||
changed_rect = Gfx::IntRect::from_two_points(event.position(), event.position());
|
||||
}
|
||||
changed_rect.inflate(m_thickness, m_thickness);
|
||||
changed_rect.inflate(m_thickness + 2, m_thickness + 2);
|
||||
layer.did_modify_bitmap(changed_rect);
|
||||
|
||||
m_last_drawing_event_position = event.position();
|
||||
|
|
Loading…
Reference in a new issue