Reworked putpixel

This commit is contained in:
Andrew Alderwick 2021-08-01 00:31:22 +01:00
parent 555d38a8ef
commit b327719e38
1 changed files with 2 additions and 2 deletions

View File

@ -24,9 +24,9 @@ clear(Ppu *p)
void
putpixel(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 color)
{
Uint8 mask = layer ? 0x3 : 0xc, shift = layer * 2;
Uint8 *pixel = &p->pixels[y * p->width + x], shift = layer * 2;
if(x < p->width && y < p->height)
p->pixels[y * p->width + x] = (p->pixels[y * p->width + x] & mask) | (color << shift);
*pixel = (*pixel & ~(0x3 << shift)) | (color << shift);
}
void