draw565: Fix bug in the straight line optimization
Currently the line drawing code does not draw the final pixel of straight lines. Thus a line from (0, 0) to (10, 10) finishes on a different pixel to (10, 0) to (10, 10). Fix this by removing the spurious subtract one from the end point Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
6d74d4f585
commit
8c1ab85257
1 changed files with 2 additions and 2 deletions
|
@ -395,8 +395,8 @@ class Draw565(object):
|
||||||
if x1 < x0 or y1 < y0:
|
if x1 < x0 or y1 < y0:
|
||||||
x0, x1 = x1, x0
|
x0, x1 = x1, x0
|
||||||
y0, y1 = y1, y0
|
y0, y1 = y1, y0
|
||||||
w = width if dx == 0 else (dx + width - 1)
|
w = width if dx == 0 else (dx + width)
|
||||||
h = width if dy == 0 else (-dy + width - 1)
|
h = width if dy == 0 else (-dy + width)
|
||||||
self.fill(color, x0, y0, w, h)
|
self.fill(color, x0, y0, w, h)
|
||||||
return
|
return
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in a new issue