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.
This commit is contained in:
Andreas Kling 2019-11-29 22:31:45 +01:00
parent e2b88f66d3
commit f04394b9f3
Notes: sideshowbarker 2024-07-19 11:01:39 +09:00

View file

@ -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)