diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-03-09 21:29:35 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-03-09 21:29:35 (GMT) |
| commit | 69bc452c65980903b309d075087941c5f5430cb1 (patch) | |
| tree | cc2ae0f93e677db0b34644a8a80782cc3ae5846e /wasp/draw565.py | |
| parent | 031d139b7c31f83791c8c35cc78624aa1eda6da2 (diff) | |
draw565: Optimize the font rendering
This is a big one... more than 4x increase in font rendering performance!
Diffstat (limited to 'wasp/draw565.py')
| -rw-r--r-- | wasp/draw565.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/wasp/draw565.py b/wasp/draw565.py index e1beb51..bd72c65 100644 --- a/wasp/draw565.py +++ b/wasp/draw565.py @@ -47,17 +47,19 @@ def _bounding_box(s, font): return (w, h) +@micropython.native def _draw_glyph(display, glyph, x, y, bgfg): (px, h, w) = glyph buf = memoryview(display.linebuffer)[0:2*(w+1)] + buf[2*w] = 0 + buf[2*w + 1] = 0 bytes_per_row = (w + 7) // 8 + display.set_window(x, y, w+1, h) for row in range(h): _bitblit(buf, px[row*bytes_per_row:], bgfg, w) - buf[2*w] = 0 - buf[2*w + 1] = 0 - display.rawblit(buf, x, y+row, w+1, 1) + display.write_data(buf) class Draw565(object): """Drawing library for RGB565 displays. |
