From 28aaf40e6db9909f76cada6edc43295cdd024b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigrid=20Solveig=20Hafl=C3=ADnud=C3=B3ttir?= Date: Tue, 2 Nov 2021 18:18:30 +0100 Subject: [PATCH] ppu_write: put new byte value only if it's different --- src/devices/ppu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/devices/ppu.c b/src/devices/ppu.c index 20c4abe..9d04511 100644 --- a/src/devices/ppu.c +++ b/src/devices/ppu.c @@ -61,9 +61,10 @@ ppu_write(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 color) Uint8 pix = p->pixels[row]; Uint8 mask = ~(0x3 << shift); Uint8 pixnew = (pix & mask) + (color << shift); - p->pixels[row] = pixnew; - if(pix != pixnew) + if(pix != pixnew){ + p->pixels[row] = pixnew; p->reqdraw = 1; + } } }