diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-04-06 20:47:30 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-04-06 21:04:21 (GMT) |
| commit | 59bb70fa649d1994d367e69fb6272f36a6176825 (patch) | |
| tree | 5e8ef6b320f6f4169f35033f331f3afe9bdcadd6 | |
| parent | a1a8f3f8a39cc014cf12b329475418a4d232434d (diff) | |
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).
| -rw-r--r-- | wasp/boards/simulator/display.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/wasp/boards/simulator/display.py b/wasp/boards/simulator/display.py index 7fdbef6..c226050 100644 --- a/wasp/boards/simulator/display.py +++ b/wasp/boards/simulator/display.py @@ -41,7 +41,8 @@ class ST7789Sim(object): self.y = self.rowclip[0] elif self.cmd == RAMWR: - pixelview = sdl2.ext.PixelView(windowsurface) + #pixelview = sdl2.ext.PixelView(windowsurface) + pixelview = sdl2.ext.pixels2d(windowsurface) half = False for d in data: @@ -52,11 +53,14 @@ class ST7789Sim(object): rgb |= d half = False - pixel = ((rgb & 0xf800) >> 8, - (rgb & 0x07e0) >> 3, - (rgb & 0x001f) << 3) + #pixel = ((rgb & 0xf800) >> 8, + # (rgb & 0x07e0) >> 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 if self.x > self.colclip[1]: |
