commit 2a92382
Devine Lu Linvega
·
2025-12-31 04:14:48 +0000 UTC
parent 2d11de7
Took opaque out of the tight loop
1 files changed,
+14,
-17
+14,
-17
1@@ -574,7 +574,8 @@ screen_draw_pixel(void)
2 #define PUT_PIXEL(n, op) if(op | color) dst[n] = (dst[n] & layer_mask) | table[color];
3 #define GET_COLOR(depth) const int color = depth ? (((ch1 >> qx) & 1) | ((ch2 >> qx) & 2)) : (ch1 >> qx) & 1;
4
5-#define PUT_PIXELS(n,op,depth) {\
6+#define PUT_PIXELS(n,op,depth,c1,c2) {\
7+ int qx = qfx; const int ch1 = c1, ch2 = c2;\
8 {GET_COLOR(depth) PUT_PIXEL(0, op); qx -= fx; }\
9 {GET_COLOR(depth) PUT_PIXEL(1, op); qx -= fx; }\
10 {GET_COLOR(depth) PUT_PIXEL(2, op); qx -= fx; }\
11@@ -615,14 +616,12 @@ screen_draw_sprite(void)
12 if(xmar2 == xmar + 8 && ymar2 == ymar + 8 && xmar2 < screen_wmar2 && ymar2 < screen_hmar2) {
13 Uint8 *dst = &screen_layers[xmar + ymar * screen_wmar2];
14 Uint8 *sch1 = &ram[rA + qfy], *sch2 = sch1 + 8;
15- for(row = 0; row < 8; row++, dst += screen_wmar2, sch1 += fy, sch2 += fy) {
16- const int ch1 = *sch1, ch2 = *sch2 << 1;
17- int qx = qfx;
18- if(opaque)
19- PUT_PIXELS(n, 1, 1)
20- else
21- PUT_PIXELS(n, 0, 1)
22- }
23+ if(opaque)
24+ for(row = 0; row < 8; row++, dst += screen_wmar2, sch1 += fy, sch2 += fy)
25+ PUT_PIXELS(n, 1, 1, *sch1, *sch2 << 1)
26+ else
27+ for(row = 0; row < 8; row++, dst += screen_wmar2, sch1 += fy, sch2 += fy)
28+ PUT_PIXELS(n, 0, 1, *sch1, *sch2 << 1)
29 }
30 }
31 } else {
32@@ -632,14 +631,12 @@ screen_draw_sprite(void)
33 if(xmar2 == xmar + 8 && ymar2 == ymar + 8 && xmar2 < screen_wmar2 && ymar2 < screen_hmar2) {
34 Uint8 *dst = &screen_layers[xmar + ymar * screen_wmar2];
35 Uint8 *sch1 = &ram[rA + qfy];
36- for(row = 0; row < 8; row++, dst += screen_wmar2, sch1 += fy) {
37- const int ch1 = *sch1, ch2 = 0;
38- int qx = qfx;
39- if(opaque)
40- PUT_PIXELS(n, 1, 0)
41- else
42- PUT_PIXELS(n, 0, 0)
43- }
44+ if(opaque)
45+ for(row = 0; row < 8; row++, dst += screen_wmar2, sch1 += fy)
46+ PUT_PIXELS(n, 1, 0, *sch1, 0)
47+ else
48+ for(row = 0; row < 8; row++, dst += screen_wmar2, sch1 += fy)
49+ PUT_PIXELS(n, 0, 0, *sch1, 0)
50 }
51 }
52 }