Browse code

ppu_blit: mostly cosmetic - explain blending's 4th row, gain few more cycles

Sigrid Solveig Haflínudóttir authored on 25/12/2021 15:26:01
Showing 1 changed files
... ...
@@ -103,13 +103,14 @@ ppu_write(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color)
103 103
 void
104 104
 ppu_blit(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy, Uint8 twobpp)
105 105
 {
106
+	Uint8 opaque = blending[4][color];
106 107
 	Uint16 v, h;
107 108
 	for(v = 0; v < 8; ++v)
108 109
 		for(h = 0; h < 8; ++h) {
109 110
 			Uint8 ch = (sprite[v + 0] >> (7 - h)) & 0x1;
110 111
 			if(twobpp)
111 112
 				ch |= ((sprite[v + 8] >> (7 - h)) & 0x1) << 1;
112
-			if(ch || blending[4][color])
113
+			if(opaque || ch)
113 114
 				ppu_write(p,
114 115
 					layer,
115 116
 					x + (flipx ? 7 - h : h),