diff options
author | Linus Groh <mail@linusgroh.de> | 2020-05-10 11:56:22 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-10 13:34:59 +0200 |
commit | da42279171c8a10864de7f1962986a782f379408 (patch) | |
tree | 141a7bb9d41c53ad375826619766fcd9759c155d /Libraries | |
parent | eb43e2d544e10b9a9f6ff80c7d5f16f502afe781 (diff) | |
download | serenity-da42279171c8a10864de7f1962986a782f379408.zip |
LibGfx: Fix dotted lines with thickness > 1
If we just skip every second pixel, we still get a solid line if each
"pixel" is wider than 1!
Now we skip the same amount of pixels as the line is thick.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibGfx/Painter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibGfx/Painter.cpp b/Libraries/LibGfx/Painter.cpp index 418e1d47f2..5387b3c707 100644 --- a/Libraries/LibGfx/Painter.cpp +++ b/Libraries/LibGfx/Painter.cpp @@ -990,7 +990,7 @@ void Painter::draw_line(const Point& p1, const Point& p2, Color color, int thick int min_y = max(point1.y(), clip_rect.top()); int max_y = min(point2.y(), clip_rect.bottom()); if (dotted) { - for (int y = min_y; y <= max_y; y += 2) + for (int y = min_y; y <= max_y; y += thickness * 2) draw_pixel({ x, y }, color, thickness); } else { for (int y = min_y; y <= max_y; ++y) @@ -1013,7 +1013,7 @@ void Painter::draw_line(const Point& p1, const Point& p2, Color color, int thick int min_x = max(point1.x(), clip_rect.left()); int max_x = min(point2.x(), clip_rect.right()); if (dotted) { - for (int x = min_x; x <= max_x; x += 2) + for (int x = min_x; x <= max_x; x += thickness * 2) draw_pixel({ x, y }, color, thickness); } else { for (int x = min_x; x <= max_x; ++x) |