summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-05-17 08:47:15 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-05-17 08:47:15 (GMT)
commitac1a799bfa8d73653c3b1994a17611deb949c7fd (patch)
tree2f26f4f26ae4274cf0954b0352b4bbca6c8c84b6
parent4906d46ff42ec9ecec49de375677dd6654455845 (diff)
draw565: Fix line optimization code
sx is measured in pixels (2-bytes) and len(display.linebuffer) gives a value in bytes so the divisor isn't right. Whilst we are here let's make sure we use integer division too. Fixes: #18
-rw-r--r--wasp/draw565.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/wasp/draw565.py b/wasp/draw565.py
index a69e526..e7914b8 100644
--- a/wasp/draw565.py
+++ b/wasp/draw565.py
@@ -179,9 +179,9 @@ class Draw565(object):
display.set_window(x, y, sx, sy)
- if sx <= (len(display.linebuffer) / 2) and not bool(sy & 1):
+ if sx <= (len(display.linebuffer) // 4) and not bool(sy & 1):
sx *= 2
- sy /= 2
+ sy //= 2
palette = array.array('H', (0, 0xfffe, 0x7bef, 0xffff))
next_color = 1