Fix line drawing algorithm

This commit is contained in:
Luflosi 2019-10-18 21:26:11 +02:00
parent 7b4141b0c8
commit f93b605b75
No known key found for this signature in database
GPG Key ID: 14140F703B7D8362

View File

@ -238,9 +238,13 @@ def antialiased_1px_line(buf, width, height, p1, p2):
grad = dy/dx
intery = y1 + rfpart(x1) * grad
xstart = draw_endpoint(p(*p1)) + 1
xstart = draw_endpoint(p(*p1))
xend = draw_endpoint(p(*p2))
if xstart > xend:
xstart, xend = xend, xstart
xstart += 1
for x in range(xstart, xend):
y = int(intery)
putpixel(p(x, y), rfpart(intery))