summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorGal Horowitz <galush.horowitz@gmail.com>2021-10-02 19:45:07 +0300
committerAndreas Kling <kling@serenityos.org>2021-10-02 20:54:47 +0200
commitaa180c821d3135fc16d814fed6268cb45548d106 (patch)
tree4c441b2e2b5cddd457e2ea555735d0327a77d344 /Userland
parentcd7473d1a36f4fb5815d9dd46d9549f49e849bb6 (diff)
downloadserenity-aa180c821d3135fc16d814fed6268cb45548d106.zip
LibGFX: Draw the ends of lines with non-standard thickness
Lines are drawn using squares the size of the thickness, so if the length of the line was not a multiple of the thickness, the end of the line was not drawn correctly.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGfx/Painter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp
index b1b107d996..868e42748f 100644
--- a/Userland/Libraries/LibGfx/Painter.cpp
+++ b/Userland/Libraries/LibGfx/Painter.cpp
@@ -1739,6 +1739,7 @@ void Painter::draw_line(IntPoint const& a_p1, IntPoint const& a_p2, Color color,
} else {
for (int y = min_y; y <= max_y; y += thickness)
draw_physical_pixel({ x, y }, color, thickness);
+ draw_physical_pixel({ x, max_y }, color, thickness);
}
return;
}
@@ -1773,6 +1774,7 @@ void Painter::draw_line(IntPoint const& a_p1, IntPoint const& a_p2, Color color,
} else {
for (int x = min_x; x <= max_x; x += thickness)
draw_physical_pixel({ x, y }, color, thickness);
+ draw_physical_pixel({ max_x, y }, color, thickness);
}
return;
}