summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint
diff options
context:
space:
mode:
authorMustafa Quraish <mustafaq9@gmail.com>2021-09-11 13:29:25 -0400
committerAndreas Kling <kling@serenityos.org>2021-09-12 00:17:04 +0200
commit451cba8b470d785c549d5dc6b83169052be81c20 (patch)
treec125f6b680f6b00a6699da98ec9d44e3499121cc /Userland/Applications/PixelPaint
parent6d55e0572d9066b98a83dc863b9dbaac9698319b (diff)
downloadserenity-451cba8b470d785c549d5dc6b83169052be81c20.zip
PixelPaint: Don't draw pixel grid outside image bounds
Fixes #9971
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp
index 0f56691a62..ce8f2a4fcd 100644
--- a/Userland/Applications/PixelPaint/ImageEditor.cpp
+++ b/Userland/Applications/PixelPaint/ImageEditor.cpp
@@ -88,8 +88,8 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
const float pixel_grid_threshold = 15.0f;
if (m_show_pixel_grid && m_scale > pixel_grid_threshold) {
- auto grid_rect = m_editor_image_rect.intersected(event.rect());
- auto image_rect = enclosing_int_rect(editor_rect_to_image_rect(grid_rect)).inflated(1, 1);
+ auto event_image_rect = enclosing_int_rect(editor_rect_to_image_rect(event.rect())).inflated(1, 1);
+ auto image_rect = m_image->rect().inflated(1, 1).intersected(event_image_rect);
for (auto i = image_rect.left(); i < image_rect.right(); i++) {
auto start_point = image_position_to_editor_position({ i, image_rect.top() }).to_type<int>();