commit e4c539f
Devine Lu Linvega
·
2026-01-10 01:54:00 +0000 UTC
parent 650d305
Removed opaque branching
1 files changed,
+4,
-4
+4,
-4
1@@ -599,6 +599,7 @@ screen_deo_sprite(void)
2 const int ctrl = dev[0x2f];
3 const int blend = ctrl & 0xf;
4 const int opaque = blend % 5;
5+ const int opaque_mask = -opaque;
6 const int flipx = ctrl & 0x10;
7 const int flipy = ctrl & 0x20;
8 const int layer_mask = (ctrl & 0x40) ? 0x3 : 0xc;
9@@ -617,16 +618,15 @@ screen_deo_sprite(void)
10 if(x0 + 8 >= stride || y0 + 8 >= screen_hmar2) continue;
11 Uint8 *dst = screen_layers + y0 * stride + x0;
12 const Uint8 *src = &ram[rA + qfy];
13- const Uint8 *src_end = src + 8 * src_stride;
14 for(j = 0; j < 8; j++, dst += stride, src += src_stride) {
15 const int ch1 = *src, ch2 = is_2bpp ? (src[8] << 1) : 0;
16 int qx = qfx;
17 Uint8 *d = dst;
18 const Uint8 *d_end = dst + 8;
19 for(; d != d_end; d++, qx += qx_step) {
20- int color = ((ch1 >> qx) & 1) | ((ch2 >> qx) & 2);
21- if(opaque || color)
22- *d = (*d & layer_mask) | table[color];
23+ const int color = ((ch1 >> qx) & 1) | ((ch2 >> qx) & 2);
24+ const int write = color | opaque_mask;
25+ if(write) *d = (*d & layer_mask) | table[color];
26 }
27 }
28 }