wasp: simulator: Optimize the drawing process
This makes per-pixel access more than double the performnace of a regular pixelview (but at the expense of requiring numpy).
This commit is contained in:
parent
a1a8f3f8a3
commit
59bb70fa64
1 changed files with 9 additions and 5 deletions
|
@ -41,7 +41,8 @@ class ST7789Sim(object):
|
||||||
self.y = self.rowclip[0]
|
self.y = self.rowclip[0]
|
||||||
|
|
||||||
elif self.cmd == RAMWR:
|
elif self.cmd == RAMWR:
|
||||||
pixelview = sdl2.ext.PixelView(windowsurface)
|
#pixelview = sdl2.ext.PixelView(windowsurface)
|
||||||
|
pixelview = sdl2.ext.pixels2d(windowsurface)
|
||||||
|
|
||||||
half = False
|
half = False
|
||||||
for d in data:
|
for d in data:
|
||||||
|
@ -52,11 +53,14 @@ class ST7789Sim(object):
|
||||||
rgb |= d
|
rgb |= d
|
||||||
half = False
|
half = False
|
||||||
|
|
||||||
pixel = ((rgb & 0xf800) >> 8,
|
#pixel = ((rgb & 0xf800) >> 8,
|
||||||
(rgb & 0x07e0) >> 3,
|
# (rgb & 0x07e0) >> 3,
|
||||||
(rgb & 0x001f) << 3)
|
# (rgb & 0x001f) << 3)
|
||||||
|
pixel = (((rgb & 0xf800) << 8) +
|
||||||
|
((rgb & 0x07e0) << 5) +
|
||||||
|
((rgb & 0x001f) << 3))
|
||||||
|
|
||||||
pixelview[self.y][self.x] = pixel
|
pixelview[self.x][self.y] = pixel
|
||||||
|
|
||||||
self.x += 1
|
self.x += 1
|
||||||
if self.x > self.colclip[1]:
|
if self.x > self.colclip[1]:
|
||||||
|
|
Loading…
Reference in a new issue