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: cc34c5d46d
("draw565: Fix wrong background color of strings")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
ed3f1c1e71
commit
58b5c0378e
1 changed files with 2 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue