commit 2d11de7
Devine Lu Linvega
·
2025-12-31 02:01:58 +0000 UTC
parent fd7196b
Simplified macros
1 files changed,
+16,
-16
+16,
-16
1@@ -572,17 +572,17 @@ screen_draw_pixel(void)
2 /* clang-format off */
3
4 #define PUT_PIXEL(n, op) if(op | color) dst[n] = (dst[n] & layer_mask) | table[color];
5-#define GET_COLOR(depth, ch1, ch2, qx) const int color = depth ? (((ch1 >> qx) & 1) | ((ch2 >> qx) & 2)) : (ch1 >> qx) & 1;
6-
7-#define PUT_PIXELS(n,op,depth,ch1,ch2, qx) {\
8- {GET_COLOR(depth, ch1, ch2, qx) PUT_PIXEL(0, op); qx -= fx; }\
9- {GET_COLOR(depth, ch1, ch2, qx) PUT_PIXEL(1, op); qx -= fx; }\
10- {GET_COLOR(depth, ch1, ch2, qx) PUT_PIXEL(2, op); qx -= fx; }\
11- {GET_COLOR(depth, ch1, ch2, qx) PUT_PIXEL(3, op); qx -= fx; }\
12- {GET_COLOR(depth, ch1, ch2, qx) PUT_PIXEL(4, op); qx -= fx; }\
13- {GET_COLOR(depth, ch1, ch2, qx) PUT_PIXEL(5, op); qx -= fx; }\
14- {GET_COLOR(depth, ch1, ch2, qx) PUT_PIXEL(6, op); qx -= fx; }\
15- {GET_COLOR(depth, ch1, ch2, qx) PUT_PIXEL(7, op); qx -= fx; }\
16+#define GET_COLOR(depth) const int color = depth ? (((ch1 >> qx) & 1) | ((ch2 >> qx) & 2)) : (ch1 >> qx) & 1;
17+
18+#define PUT_PIXELS(n,op,depth) {\
19+ {GET_COLOR(depth) PUT_PIXEL(0, op); qx -= fx; }\
20+ {GET_COLOR(depth) PUT_PIXEL(1, op); qx -= fx; }\
21+ {GET_COLOR(depth) PUT_PIXEL(2, op); qx -= fx; }\
22+ {GET_COLOR(depth) PUT_PIXEL(3, op); qx -= fx; }\
23+ {GET_COLOR(depth) PUT_PIXEL(4, op); qx -= fx; }\
24+ {GET_COLOR(depth) PUT_PIXEL(5, op); qx -= fx; }\
25+ {GET_COLOR(depth) PUT_PIXEL(6, op); qx -= fx; }\
26+ {GET_COLOR(depth) PUT_PIXEL(7, op); qx -= fx; }\
27 }
28
29 /* clang-format on */
30@@ -619,9 +619,9 @@ screen_draw_sprite(void)
31 const int ch1 = *sch1, ch2 = *sch2 << 1;
32 int qx = qfx;
33 if(opaque)
34- PUT_PIXELS(n, 1, 1, ch1, ch2, qx)
35+ PUT_PIXELS(n, 1, 1)
36 else
37- PUT_PIXELS(n, 0, 1, ch1, ch2, qx)
38+ PUT_PIXELS(n, 0, 1)
39 }
40 }
41 }
42@@ -633,12 +633,12 @@ screen_draw_sprite(void)
43 Uint8 *dst = &screen_layers[xmar + ymar * screen_wmar2];
44 Uint8 *sch1 = &ram[rA + qfy];
45 for(row = 0; row < 8; row++, dst += screen_wmar2, sch1 += fy) {
46- const int ch1 = *sch1;
47+ const int ch1 = *sch1, ch2 = 0;
48 int qx = qfx;
49 if(opaque)
50- PUT_PIXELS(n, 1, 0, ch1, 0, qx)
51+ PUT_PIXELS(n, 1, 0)
52 else
53- PUT_PIXELS(n, 0, 0, ch1, 0, qx)
54+ PUT_PIXELS(n, 0, 0)
55 }
56 }
57 }