commit 140ef7e

Devine Lu Linvega  ·  2025-12-30 23:22:48 +0000 UTC
parent 92fa022
Trying to macro the heck out of this problem
1 files changed,  +8, -4
+8, -4
 1@@ -571,10 +571,14 @@ screen_draw_pixel(void)
 2 
 3 /* clang-format off */
 4 
 5-#define o1BPP(n) { const int qx = qfx - n * fx; dst[n] = (dst[n] & layer_mask) | table[(ch1 >> qx) & 1]; }
 6-#define a1BPP(n) { const int qx = qfx - n * fx; const int color = (ch1 >> qx) & 1; if(color) dst[n] = (dst[n] & layer_mask) | table[color]; }
 7-#define o2BPP(n) { const int qx = qfx - n * fx; dst[n] = (dst[n] & layer_mask) | table[((ch1 >> qx) & 1) | ((ch2 >> qx) & 2)]; }
 8-#define a2BPP(n) { const int qx = qfx - n * fx; const int color = ((ch1 >> qx) & 1) | ((ch2 >> qx) & 2); if(color) dst[n] = (dst[n] & layer_mask) | table[color]; }
 9+#define GET_SHIFT const int qx = qfx - n * fx;
10+#define PUT_PIXEL(n) { dst[n] = (dst[n] & layer_mask) | table[color]; }
11+#define GET_1BPP const int color = (ch1 >> qx) & 1;
12+#define GET_2BPP const int color = ((ch1 >> qx) & 1) | ((ch2 >> qx) & 2);
13+#define o1BPP(n) { GET_SHIFT GET_1BPP PUT_PIXEL(n) }
14+#define a1BPP(n) { GET_SHIFT GET_1BPP if(color) PUT_PIXEL(n) }
15+#define o2BPP(n) { GET_SHIFT GET_2BPP PUT_PIXEL(n) }
16+#define a2BPP(n) { GET_SHIFT GET_2BPP if(color) PUT_PIXEL(n) }
17 
18 /* clang-format on */
19