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