commit 5ae0406

Devine Lu Linvega  ·  2026-01-10 03:23:53 +0000 UTC
parent e929ecc
Removed branching in sprite drawing
1 files changed,  +6, -4
+6, -4
 1@@ -623,14 +623,16 @@ screen_deo_sprite(void)
 2 			if(flipx)
 3 				for(int px = 0; px < 8; px++, d++) {
 4 					const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0);
 5-					if(color | opaque_mask) *d = (*d & layer_mask) | table[color];
 6-					bit <<= 1;
 7+					const Uint8 mask = (color | opaque_mask) ? 0xFF : 0x00;
 8+					const Uint8 newp = (*d & layer_mask) | table[color];
 9+					*d = (*d & ~mask) | (newp & mask), bit <<= 1;
10 				}
11 			else
12 				for(int px = 0; px < 8; px++, d++) {
13 					const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0);
14-					if(color | opaque_mask) *d = (*d & layer_mask) | table[color];
15-					bit >>= 1;
16+					const Uint8 mask = (color | opaque_mask) ? 0xFF : 0x00;
17+					const Uint8 newp = (*d & layer_mask) | table[color];
18+					*d = (*d & ~mask) | (newp & mask), bit >>= 1;
19 				}
20 		}
21 	}