summaryrefslogtreecommitdiff
path: root/wasp/apps
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-27 08:47:05 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-27 08:52:54 (GMT)
commit8c03ddbb7af3fb68791b7c8ee050ee4d8f3d9dbf (patch)
tree37951008227eefc923ed61c0891eb8b5c33e11c0 /wasp/apps
parent8a14faa66867c2dfdef66c48a0669c00a5e4440e (diff)
draw565: Add width to the line drawing function
Currently all lines are a single pixel wide. To draw wider lines we must draw two parallel lines with a single pixel offset and this is a *very* inefficient approach, espeically on ST7789 where we spend longer setting the clipping window than we do drawing each pixel. Fix this by constructing a line using a variable sized square rather than a single pixel. This will "overdraw" (some pixels will be drawn more than once) but since square blocks can be efficiently transferred to the display the overdraw is acceptable. Note: It is a difficult decision whether to maintain the convention that color is the last argument or to keep compatibility with existing line drawing tests. This patch opts for the former and fixes up all uses within the existing codebase. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps')
-rw-r--r--wasp/apps/testapp.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py
index 2b2e05b..6b813e4 100644
--- a/wasp/apps/testapp.py
+++ b/wasp/apps/testapp.py
@@ -183,10 +183,10 @@ class TestApp():
t = machine.Timer(id=1, period=8000000)
t.start()
for x, y in points:
- draw.line(120, 120, 120+x, 120+y, 0xfbc0)
- draw.line(120, 120, 120+y, 120-x, 0x07c0)
- draw.line(120, 120, 120-x, 120-y, 0x6b3f)
- draw.line(120, 120, 120-y, 120+x, 0xffe0)
+ draw.line(120, 120, 120+x, 120+y, 4, 0xfb00) # red
+ draw.line(120, 120, 120+y, 120-x, 3, 0x07c0) # green
+ draw.line(120, 120, 120-x, 120-y, 5, 0x6b3f) # blue
+ draw.line(120, 120, 120-y, 120+x, 2, 0xffe0) # yellow
elapsed = t.time()
t.stop()
del t