commit 1ed4169

Devine Lu Linvega  ·  2026-01-11 18:12:28 +0000 UTC
parent 42afb3a
Macroed writing a pixel
1 files changed,  +12, -12
+12, -12
 1@@ -592,6 +592,14 @@ screen_deo_pixel(void)
 2 	}
 3 }
 4 
 5+#define PIXEL(bit) \
 6+	{ \
 7+		const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0); \
 8+		const Uint8 mask = (color | opaque_mask) ? 0xff : 0x00; \
 9+		const Uint8 next = (*d & layer_mask) | table[color]; \
10+		*d = (*d & ~mask) | (next & mask); \
11+	}
12+
13 static void
14 screen_deo_sprite(void)
15 {
16@@ -617,19 +625,11 @@ screen_deo_sprite(void)
17 			const int ch1 = *src, ch2 = is_2bpp ? (src[8] << 1) : 0;
18 			Uint8 *d = dst;
19 			if(flipx)
20-				for(int px = 0, bit = 0x01; px < 8; px++, d++) {
21-					const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0);
22-					const Uint8 mask = (color | opaque_mask) ? 0xff : 0x00;
23-					const Uint8 next = (*d & layer_mask) | table[color];
24-					*d = (*d & ~mask) | (next & mask), bit <<= 1;
25-				}
26+				for(int px = 0, bit = 0x01; px < 8; px++, d++, bit <<= 1)
27+					PIXEL(bit)
28 			else
29-				for(int px = 0, bit = 0x80; px < 8; px++, d++) {
30-					const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0);
31-					const Uint8 mask = (color | opaque_mask) ? 0xff : 0x00;
32-					const Uint8 next = (*d & layer_mask) | table[color];
33-					*d = (*d & ~mask) | (next & mask), bit >>= 1;
34-				}
35+				for(int px = 0, bit = 0x80; px < 8; px++, d++, bit >>= 1)
36+					PIXEL(bit)
37 		}
38 	}
39 	if(!screen_reqdraw) {