Inlined ppu_read

This commit is contained in:
neauoire 2021-12-24 10:02:23 -08:00
parent 3fb4d40eb0
commit cc6f2c8b29
1 changed files with 5 additions and 12 deletions

View File

@ -84,19 +84,12 @@ ppu_redraw(Ppu *p, Uint32 *screen)
{ {
Uint16 x, y; Uint16 x, y;
for(y = 0; y < p->height; ++y) for(y = 0; y < p->height; ++y)
for(x = 0; x < p->width; ++x) for(x = 0; x < p->width; ++x) {
screen[x + y * p->width] = p->palette[ppu_read(p, x, y)];
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); Uint32 row = (x + y * p->width);
return p->fg[row] ? p->fg[row] : p->bg[row]; Uint8 color = p->fg[row] ? p->fg[row] : p->bg[row];
screen[x + y * p->width] = p->palette[color];
} }
return 0x0; p->reqdraw = 0;
} }
void void