draw565: Optimize string drawing
Avoid needless bouncing the chip select when drawing glyphs. This improved performance by around 15% for 24pt fonts. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
5170b97491
commit
2fe3ac1388
1 changed files with 5 additions and 1 deletions
|
@ -91,9 +91,13 @@ def _draw_glyph(display, glyph, x, y, bgfg):
|
||||||
bytes_per_row = (w + 7) // 8
|
bytes_per_row = (w + 7) // 8
|
||||||
|
|
||||||
display.set_window(x, y, w+1, h)
|
display.set_window(x, y, w+1, h)
|
||||||
|
quick_write = display.quick_write
|
||||||
|
|
||||||
|
display.quick_start()
|
||||||
for row in range(h):
|
for row in range(h):
|
||||||
_bitblit(buf, px[row*bytes_per_row:], bgfg, w)
|
_bitblit(buf, px[row*bytes_per_row:], bgfg, w)
|
||||||
display.write_data(buf)
|
quick_write(buf)
|
||||||
|
display.quick_end()
|
||||||
|
|
||||||
class Draw565(object):
|
class Draw565(object):
|
||||||
"""Drawing library for RGB565 displays.
|
"""Drawing library for RGB565 displays.
|
||||||
|
|
Loading…
Reference in a new issue