From f04394b9f3681b8683c76031c271a202069a5efd Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 29 Nov 2019 22:31:45 +0100 Subject: [PATCH] LibDraw: Painter::draw_pixel() with thickness>1 was doubly translating Callers of draw_pixel() are not expecting it to apply translation since they will have already done that themselves. This was causing draw_line() with thickness>1 to have an offset applied in case the painter was already translated. --- Libraries/LibDraw/Painter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibDraw/Painter.cpp b/Libraries/LibDraw/Painter.cpp index 3b08c67bc49..fd46e51ab4c 100644 --- a/Libraries/LibDraw/Painter.cpp +++ b/Libraries/LibDraw/Painter.cpp @@ -770,7 +770,7 @@ void Painter::draw_pixel(const Point& position, Color color, int thickness) if (thickness == 1) return set_pixel_with_draw_op(m_target->scanline(position.y())[position.x()], color); Rect rect { position.translated(-(thickness / 2), -(thickness / 2)), { thickness, thickness } }; - fill_rect(rect, color); + fill_rect(rect.translated(-state().translation), color); } void Painter::draw_line(const Point& p1, const Point& p2, Color color, int thickness, bool dotted)