wasp: draw565: Optimize the bit expansion blitter slightly.
This commit is contained in:
parent
22ca8886c2
commit
f734568ad2
1 changed files with 5 additions and 8 deletions
|
@ -7,13 +7,12 @@ import micropython
|
||||||
|
|
||||||
@micropython.viper
|
@micropython.viper
|
||||||
def _bitblit(bitbuf, pixels, bgfg: int, count: int):
|
def _bitblit(bitbuf, pixels, bgfg: int, count: int):
|
||||||
mv = ptr8(bitbuf)
|
mv = ptr16(bitbuf)
|
||||||
px = ptr8(pixels)
|
px = ptr8(pixels)
|
||||||
|
|
||||||
bghi = (bgfg >> 24) & 0xff
|
# Extract and byte-swap
|
||||||
bglo = (bgfg >> 16) & 0xff
|
bg = ((bgfg >> 24) & 0xff) + ((bgfg >> 8) & 0xff00)
|
||||||
fghi = (bgfg >> 8) & 0xff
|
fg = ((bgfg >> 8) & 0xff) + ((bgfg & 0xff) << 8)
|
||||||
fglo = (bgfg ) & 0xff
|
|
||||||
|
|
||||||
bitselect = 0x80
|
bitselect = 0x80
|
||||||
pxp = 0
|
pxp = 0
|
||||||
|
@ -22,9 +21,7 @@ def _bitblit(bitbuf, pixels, bgfg: int, count: int):
|
||||||
for bit in range(count):
|
for bit in range(count):
|
||||||
# Draw the pixel
|
# Draw the pixel
|
||||||
active = px[pxp] & bitselect
|
active = px[pxp] & bitselect
|
||||||
mv[mvp] = fghi if active else bghi
|
mv[mvp] = fg if active else bg
|
||||||
mvp += 1
|
|
||||||
mv[mvp] = fglo if active else bglo
|
|
||||||
mvp += 1
|
mvp += 1
|
||||||
|
|
||||||
# Advance to the next bit
|
# Advance to the next bit
|
||||||
|
|
Loading…
Reference in a new issue