diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-03-29 21:16:43 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-03-29 21:16:43 (GMT) |
| commit | 58b5c0378ec3d5421a4af2bfed0434e3a286a1b0 (patch) | |
| tree | 675e3a3fe60069793f149d2ea8eabc9690a2514b /wasp/draw565.py | |
| parent | ed3f1c1e7140ccb927556912c813f3a8a7d2c108 (diff) | |
draw565: Optimize the string drawing
Currently there is a redundant fill operation issued for every character
drawn. This was added to draw the background colours correctly but the
change did not account for the optimized character rendering in
_draw_glyph().
This results in ~15% performance improvement for character rendering
Fixes: cc34c5d46de9 ("draw565: Fix wrong background color of strings")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/draw565.py')
| -rw-r--r-- | wasp/draw565.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/wasp/draw565.py b/wasp/draw565.py index c84b1ec..f831b04 100644 --- a/wasp/draw565.py +++ b/wasp/draw565.py @@ -87,8 +87,8 @@ def _draw_glyph(display, glyph, x, y, bgfg): (px, h, w) = glyph buf = display.linebuffer[0:2*(w+1)] - buf[2*w] = 0 - buf[2*w + 1] = 0 + buf[2*w] = bgfg >> 24 + buf[2*w + 1] = (bgfg >> 16) & 0xff bytes_per_row = (w + 7) // 8 display.set_window(x, y, w+1, h) @@ -324,7 +324,6 @@ class Draw565(object): for ch in s: glyph = font.get_ch(ch) _draw_glyph(display, glyph, x, y, bgfg) - self.fill(bg, x+glyph[2], y, 1, glyph[1]) x += glyph[2] + 1 if width: |
