commit 831014e8112cd4e8ede0dc96edad17b04795ddad
parent c2829ce5fe2a802f0ebd59cbecddf904e3e9fed4
Author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
Date: Sat, 25 Dec 2021 15:57:43 +0100
ppu_redraw: use the same optimization that one-layer logic had
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/devices/ppu.c b/src/devices/ppu.c
@@ -82,9 +82,11 @@ ppu_clear(Ppu *p, Layer *layer)
void
ppu_redraw(Ppu *p, Uint32 *screen)
{
- Uint32 i, size = p->width * p->height;
+ Uint32 i, size = p->width * p->height, palette[16];
+ for(i = 0; i < 16; ++i)
+ palette[i] = p->palette[(i >> 2) ? (i >> 2) : (i & 3)];
for(i = 0; i < size; ++i)
- screen[i] = p->palette[p->fg.pixels[i] ? p->fg.pixels[i] : p->bg.pixels[i]];
+ screen[i] = palette[p->fg.pixels[i] << 2 | p->bg.pixels[i]];
p->fg.changed = p->bg.changed = 0;
}