commit 40813fb
Devine Lu Linvega
·
2026-03-12 01:58:12 +0000 UTC
parent c4622fe
Removed alpha lut
1 files changed,
+13,
-12
+13,
-12
1@@ -363,8 +363,6 @@ static const Uint8 blend_lut[16][2][4] = {
2 {{3, 2, 3, 1}, {12, 8, 12, 4}},
3 {{3, 3, 1, 2}, {12, 12, 4, 8}}};
4
5-static const Uint8 alpha_lut[16] = {0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0};
6-
7 void emu_redraw(void), emu_resize(void);
8
9 static void
10@@ -517,25 +515,28 @@ screen_deo_sprite(void)
11 {
12 int i, j, x = rX, y = rY;
13 const int ctrl = dev[0x2f];
14- const int flipx = ctrl & 0x10, dx = flipx ? -rDY : rDY;
15- const int flipy = ctrl & 0x20, dy = flipy ? -rDX : rDX;
16+ const int flipx = ctrl & 0x10, flipy = ctrl & 0x20;
17+ const int dx = flipx ? -rDY : rDY, dy = flipy ? -rDX : rDX;
18 const int row_start = flipx ? 0 : 7, row_delta = flipx ? 1 : -1;
19 const int col_start = flipy ? 7 : 0, col_delta = flipy ? -1 : 1;
20 const int layer = ctrl & 0x40, layer_mask = layer ? 0x3 : 0xc;
21- const int mode_2bpp = ctrl >> 7, addr_2bpp = mode_2bpp ? rMA << 2 : rMA << 1;
22+ const int is_2bpp = ctrl & 0x80;
23+ const int addr_incr = rMA << (is_2bpp ? 2 : 1);
24+ const int stride = screen_wmar2;
25 const int blend = ctrl & 0xf;
26- const Uint8 opaque = alpha_lut[blend], *table = blend_lut[blend][layer >> 6];
27- for(i = 0; i <= rML; i++, x += dx, y += dy, rA += addr_2bpp) {
28+ const Uint8 opaque_mask = blend % 5;
29+ const Uint8 *table = blend_lut[blend][layer >> 6];
30+ for(i = 0; i <= rML; i++, x += dx, y += dy, rA += addr_incr) {
31 const Uint16 x0 = x + 8, y0 = y + 8;
32- if(x0 + 8 >= screen_wmar2 || y0 + 8 >= screen_hmar2) continue;
33- Uint8 *dst = screen_layers + y0 * screen_wmar2 + x0;
34+ if(x0 + 8 >= stride || y0 + 8 >= screen_hmar2) continue;
35+ Uint8 *dst = screen_layers + y0 * stride + x0;
36 const Uint8 *col = &ram[rA + col_start];
37- for(j = 0; j < 8; j++, dst += screen_wmar2, col += col_delta) {
38+ for(j = 0; j < 8; j++, dst += stride, col += col_delta) {
39 Uint8 *d = dst;
40- const int ch1 = *col, ch2 = mode_2bpp ? col[8] : 0;
41+ const int ch1 = *col, ch2 = is_2bpp ? col[8] : 0;
42 for(int k = 0, row = row_start; k < 8; k++, d++, row += row_delta) {
43 const int color = ((ch1 >> row) & 1) | (((ch2 >> row) & 1) << 1);
44- if(opaque || color)
45+ if(opaque_mask || color)
46 *d = (*d & layer_mask) | table[color];
47 }
48 }