commit 557b581
Devine Lu Linvega
·
2026-01-12 18:04:38 +0000 UTC
parent 46de14e
Pre-compute opaque mask
1 files changed,
+2,
-2
+2,
-2
1@@ -606,7 +606,7 @@ screen_deo_sprite(void)
2 const int addr_incr = rMA << (is_2bpp ? 2 : 1);
3 const int stride = screen_wmar2;
4 const int blend = ctrl & 0xf;
5- const int opaque = blend % 5;
6+ const Uint8 opaque_mask = (blend % 5) ? 0xff : 0x00;
7 const Uint8 *table = blend_lut[blend][layer >> 6];
8 for(i = 0; i <= rML; i++, x += dx, y += dy, rA += addr_incr) {
9 const Uint16 x0 = x + 8, y0 = y + 8;
10@@ -619,7 +619,7 @@ screen_deo_sprite(void)
11 for(int px = 0, row = row_start; px < 8; px++, d++, row += row_delta) {
12 const int bit = 1 << row;
13 const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0);
14- const Uint8 mask = (color | opaque) ? 0xff : 0x00;
15+ const Uint8 mask = -(!!(color | opaque_mask));
16 const Uint8 value = *d;
17 *d = (value & ~mask) | (((value & layer_mask) | table[color]) & mask);
18 }