commit cc6f2c8b293e0156a622535e6eb20a1dc9581a9f
parent 3fb4d40eb0400f86587ca9e0ae342cbe102efc01
Author: neauoire <aliceffekt@gmail.com>
Date: Fri, 24 Dec 2021 10:02:23 -0800
Inlined ppu_read
Diffstat:
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/devices/ppu.c b/src/devices/ppu.c
@@ -84,21 +84,14 @@ ppu_redraw(Ppu *p, Uint32 *screen)
{
Uint16 x, y;
for(y = 0; y < p->height; ++y)
- for(x = 0; x < p->width; ++x)
- screen[x + y * p->width] = p->palette[ppu_read(p, x, y)];
+ for(x = 0; x < p->width; ++x) {
+ Uint32 row = (x + y * p->width);
+ Uint8 color = p->fg[row] ? p->fg[row] : p->bg[row];
+ screen[x + y * p->width] = p->palette[color];
+ }
p->reqdraw = 0;
}
-Uint8
-ppu_read(Ppu *p, Uint16 x, Uint16 y)
-{
- if(x < p->width && y < p->height) {
- Uint32 row = (x + y * p->width);
- return p->fg[row] ? p->fg[row] : p->bg[row];
- }
- return 0x0;
-}
-
void
ppu_write(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color)
{