1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:18:12 +00:00

PixelPaint: Ensure layers are positioned correctly when painting

Previously, layer bitmaps could move slightly relative to their
boundary and the image background when panning and zooming.
This commit is contained in:
Tim Ledbetter 2023-01-05 12:26:13 +00:00 committed by Andreas Kling
parent 607c8045dc
commit 4be6ee85e0
3 changed files with 9 additions and 10 deletions

View file

@ -163,10 +163,10 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
Gfx::StylePainter::paint_transparency_grid(painter, content_rect(), palette());
painter.draw_rect(content_rect().inflated(2, 2), Color::Black);
m_image->paint_into(painter, content_rect());
m_image->paint_into(painter, content_rect(), scale());
if (m_active_layer && m_show_active_layer_boundary)
painter.draw_rect(content_to_frame_rect(m_active_layer->relative_rect()).to_rounded<int>().inflated(2, 2), Color::Black);
painter.draw_rect(content_to_frame_rect(m_active_layer->relative_rect()).to_type<int>().inflated(2, 2), Color::Black);
if (m_show_pixel_grid && scale() > m_pixel_grid_threshold) {
auto event_image_rect = enclosing_int_rect(frame_to_content_rect(event.rect())).inflated(1, 1);