mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
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.
This commit is contained in:
parent
cd7473d1a3
commit
aa180c821d
1 changed files with 2 additions and 0 deletions
|
@ -1739,6 +1739,7 @@ void Painter::draw_line(IntPoint const& a_p1, IntPoint const& a_p2, Color color,
|
||||||
} else {
|
} else {
|
||||||
for (int y = min_y; y <= max_y; y += thickness)
|
for (int y = min_y; y <= max_y; y += thickness)
|
||||||
draw_physical_pixel({ x, y }, color, thickness);
|
draw_physical_pixel({ x, y }, color, thickness);
|
||||||
|
draw_physical_pixel({ x, max_y }, color, thickness);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1773,6 +1774,7 @@ void Painter::draw_line(IntPoint const& a_p1, IntPoint const& a_p2, Color color,
|
||||||
} else {
|
} else {
|
||||||
for (int x = min_x; x <= max_x; x += thickness)
|
for (int x = min_x; x <= max_x; x += thickness)
|
||||||
draw_physical_pixel({ x, y }, color, thickness);
|
draw_physical_pixel({ x, y }, color, thickness);
|
||||||
|
draw_physical_pixel({ max_x, y }, color, thickness);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue