From 73183ee5c440c4cb1777712f1689697bf37532b4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 6 Jul 2021 12:23:02 +0200 Subject: [PATCH] PixelPaint: Paint the area around the image with ColorRole::Tray It didn't really make sense for the transparency grid to extend infinitely around the image. Now the grid is only visible underneath the image, which matches how most other editors behave. --- Userland/Applications/PixelPaint/ImageEditor.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index bd181bb686..c71b4685d5 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -11,6 +11,7 @@ #include "Tool.h" #include #include +#include #include #include @@ -65,7 +66,15 @@ void ImageEditor::paint_event(GUI::PaintEvent& event) painter.add_clip_rect(event.rect()); painter.add_clip_rect(frame_inner_rect()); - Gfx::StylePainter::paint_transparency_grid(painter, rect(), palette()); + { + Gfx::DisjointRectSet background_rects; + background_rects.add(frame_inner_rect()); + background_rects.shatter(m_editor_image_rect); + for (auto& rect : background_rects.rects()) + painter.fill_rect(rect, palette().color(Gfx::ColorRole::Tray)); + } + + Gfx::StylePainter::paint_transparency_grid(painter, m_editor_image_rect, palette()); painter.draw_rect(m_editor_image_rect.inflated(2, 2), Color::Black); m_image->paint_into(painter, m_editor_image_rect);