drawLine bugs with different display-scales, line-widths and caps

While developing a game that uses the drawing API (Lua) I noticed that diagonal lines have some rendering issues.

For my test case I rendered some 45 degree lines with the following line widths:
0.25, 0.5, 1, 2, 3, 4

All lines with Thickness 0.25 have an overdraw issue (marked green in the images), which might be related to: C API: `drawLine` API can "overdraw" by one pixel

All lines with Thickness 2 and lineCapStyle set to kLineCapStyleSquare seem to have a rendering bug (marked red in the images)

Line thickness 2 and 3 render weird line caps when set to kLineCapStyleRound (marked blue)

Here are the screenshots, line widths top line: 0.25, 0.5, 1 and second line: 2, 3, 4

1x-butt

1x-round

1x-square

2x-butt

2x-round

2x-square

4x-butt

4x-round

4x-square

And here's a PDX to test (Press A to cycle tests):
LineStyle.pdx.zip (3.2 KB)

3 Likes