~rabbits/uxn-playdate

b903bf315a7cad86fc3b2a875c3d609ffd0ecc87 — Devine Lu Linvega 13 days ago 5702f5a
Test for difference
1 files changed, 7 insertions(+), 4 deletions(-)

M src/devices/ppu.c
M src/devices/ppu.c => src/devices/ppu.c +7 -4
@@ 46,12 46,15 @@ ppu_pixel(Ppu *p, uint8_t fg, uint16_t x, uint16_t y, uint8_t color)
{
	if(x >= WIDTH || y >= HEIGHT) return;
	int offset = y * STRIDE_WORDS + x / 32;
	int i = offset * 3 + fg * 2;
	uint32_t mask = 1 << ((x & 0x18) + (7 - (x & 0x7)));
	uint32_t before = p->pixels[i];
	if(color & 0x01)
		p->pixels[offset * 3 + fg * 2] |= mask;
		p->pixels[i] |= mask;
	else
		p->pixels[offset * 3 + fg * 2] &= ~mask;
	render(p, offset, 1);
		p->pixels[i] &= ~mask;
	if(before != p->pixels[i])
		render(p, offset, 1);
}

void


@@ 59,7 62,7 @@ screen_blit(Ppu *p, uint8_t fg, uint16_t x, uint16_t y, uint8_t *sprite, uint8_t
{
	int v, h, opaque = (color % 5) || !color;
	for(v = 0; v < 8; v++) {
		uint16_t c = sprite[v] | (twobpp ? sprite[v + 8] : 0) << 8;
		uint16_t c = sprite[v] | (twobpp ? (sprite[v + 8] << 8) : 0);
		for(h = 7; h >= 0; --h, c >>= 1) {
			uint8_t ch = (c & 1) | ((c >> 7) & 2);
			if(opaque || ch)