commit 6a52595
Devine Lu Linvega
·
2026-01-12 18:50:56 +0000 UTC
parent c625783
Returned pre-computed table..
1 files changed,
+20,
-21
+20,
-21
1@@ -427,23 +427,23 @@ static int screen_vector, *screen_pixels, screen_palette[16];
2 static int rX, rY, rA, rMX, rMY, rMA, rML, rDX, rDY;
3 static Uint8 *screen_layers;
4
5-static const Uint8 blend_lut[16][4] = {
6- {0, 0, 1, 2},
7- {0, 1, 2, 3},
8- {0, 2, 3, 1},
9- {0, 3, 1, 2},
10- {1, 0, 1, 2},
11- {1, 1, 2, 3},
12- {1, 2, 3, 1},
13- {1, 3, 1, 2},
14- {2, 0, 1, 2},
15- {2, 1, 2, 3},
16- {2, 2, 3, 1},
17- {2, 3, 1, 2},
18- {3, 0, 1, 2},
19- {3, 1, 2, 3},
20- {3, 2, 3, 1},
21- {3, 3, 1, 2}};
22+static const Uint8 blend_lut[16][2][4] = {
23+ {{0, 0, 1, 2}, {0, 0, 4, 8}},
24+ {{0, 1, 2, 3}, {0, 4, 8, 12}},
25+ {{0, 2, 3, 1}, {0, 8, 12, 4}},
26+ {{0, 3, 1, 2}, {0, 12, 4, 8}},
27+ {{1, 0, 1, 2}, {4, 0, 4, 8}},
28+ {{1, 1, 2, 3}, {4, 4, 8, 12}},
29+ {{1, 2, 3, 1}, {4, 8, 12, 4}},
30+ {{1, 3, 1, 2}, {4, 12, 4, 8}},
31+ {{2, 0, 1, 2}, {8, 0, 4, 8}},
32+ {{2, 1, 2, 3}, {8, 4, 8, 12}},
33+ {{2, 2, 3, 1}, {8, 8, 12, 4}},
34+ {{2, 3, 1, 2}, {8, 12, 4, 8}},
35+ {{3, 0, 1, 2}, {12, 0, 4, 8}},
36+ {{3, 1, 2, 3}, {12, 4, 8, 12}},
37+ {{3, 2, 3, 1}, {12, 8, 12, 4}},
38+ {{3, 3, 1, 2}, {12, 12, 4, 8}}};
39
40 void emu_redraw(void), emu_resize(void);
41
42@@ -601,13 +601,13 @@ screen_deo_sprite(void)
43 const int dx = flipx ? -rDY : rDY, dy = flipy ? -rDX : rDX;
44 const int row_start = flipx ? 0 : 7, row_delta = flipx ? 1 : -1;
45 const int col_start = flipy ? 7 : 0, col_delta = flipy ? -1 : 1;
46- const int layer = ctrl & 0x40 ? 2 : 0, layer_mask = layer ? 0x3 : 0xc;
47+ const int layer = ctrl & 0x40, layer_mask = layer ? 0x3 : 0xc;
48 const int is_2bpp = ctrl & 0x80;
49 const int addr_incr = rMA << (is_2bpp ? 2 : 1);
50 const int stride = screen_wmar2;
51 const int blend = ctrl & 0xf;
52 const Uint8 opaque_mask = (blend % 5) ? 0xff : 0x00;
53- const Uint8 *table = blend_lut[blend];
54+ const Uint8 *table = blend_lut[blend][layer >> 6];
55 for(i = 0; i <= rML; i++, x += dx, y += dy, rA += addr_incr) {
56 const Uint16 x0 = x + 8, y0 = y + 8;
57 if(x0 + 8 >= stride || y0 + 8 >= screen_hmar2) continue;
58@@ -620,8 +620,7 @@ screen_deo_sprite(void)
59 const int bit = 1 << row;
60 const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0);
61 const Uint8 mask = -(!!(color | opaque_mask));
62- const Uint8 value = table[color] << layer;
63- *d = (*d & ~mask) | (((*d & layer_mask) | value) & mask);
64+ *d = (*d & ~mask) | (((*d & layer_mask) | table[color]) & mask);
65 }
66 }
67 }