commit 46de14e

Devine Lu Linvega  ·  2026-01-12 17:57:17 +0000 UTC
parent 3ddbc3b
Removed opaque lut
1 files changed,  +4, -6
+4, -6
 1@@ -445,9 +445,6 @@ static const Uint8 blend_lut[16][2][4] = {
 2 	{{3, 2, 3, 1}, {12, 8, 12, 4}},
 3 	{{0, 3, 1, 2}, {0, 12, 4, 8}}};
 4 
 5-static const int opaque_lut[16] = {
 6-	0, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0};
 7-
 8 void emu_redraw(void), emu_resize(void);
 9 
10 static void
11@@ -609,7 +606,7 @@ screen_deo_sprite(void)
12 	const int addr_incr = rMA << (is_2bpp ? 2 : 1);
13 	const int stride = screen_wmar2;
14 	const int blend = ctrl & 0xf;
15-	const int opaque_mask = opaque_lut[blend];
16+	const int opaque = blend % 5;
17 	const Uint8 *table = blend_lut[blend][layer >> 6];
18 	for(i = 0; i <= rML; i++, x += dx, y += dy, rA += addr_incr) {
19 		const Uint16 x0 = x + 8, y0 = y + 8;
20@@ -622,8 +619,9 @@ screen_deo_sprite(void)
21 			for(int px = 0, row = row_start; px < 8; px++, d++, row += row_delta) {
22 				const int bit = 1 << row;
23 				const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0);
24-				const Uint8 mask = (color | opaque_mask) ? 0xff : 0x00;
25-				*d = (*d & ~mask) | (((*d & layer_mask) | table[color]) & mask);
26+				const Uint8 mask = (color | opaque) ? 0xff : 0x00;
27+				const Uint8 value = *d;
28+				*d = (value & ~mask) | (((value & layer_mask) | table[color]) & mask);
29 			}
30 		}
31 	}