uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit b327719e38c6fc626db490da00a6c45a55f11531
parent 555d38a8ef7be98f75d859946b56239326947176
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Sun,  1 Aug 2021 00:31:22 +0100

Reworked putpixel

Diffstat:
Msrc/devices/ppu.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/devices/ppu.c b/src/devices/ppu.c @@ -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