Browse code

ppu_write: put new byte value only if it's different

Sigrid Solveig Haflínudóttir authored on 02/11/2021 17:18:30
Showing 1 changed files
... ...
@@ -61,9 +61,10 @@ ppu_write(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 color)
61 61
 		Uint8 pix = p->pixels[row];
62 62
 		Uint8 mask = ~(0x3 << shift);
63 63
 		Uint8 pixnew = (pix & mask) + (color << shift);
64
-		p->pixels[row] = pixnew;
65
-		if(pix != pixnew)
64
+		if(pix != pixnew){
65
+			p->pixels[row] = pixnew;
66 66
 			p->reqdraw = 1;
67
+		}
67 68
 	}
68 69
 }
69 70