commit 8a3cf86

Devine Lu Linvega  ·  2026-01-11 19:19:18 +0000 UTC
parent 53ddc88
Moved flipy in src outside of loop
1 files changed,  +10, -12
+10, -12
 1@@ -600,26 +600,24 @@ screen_deo_sprite(void)
 2 {
 3 	int i, j, x = rX, y = rY;
 4 	const int ctrl = dev[0x2f];
 5-	const int blend = ctrl & 0xf;
 6 	const int flipx = ctrl & 0x10, flipy = ctrl & 0x20;
 7-	const int layer = ctrl & 0x40;
 8-	const int layer_mask = layer ? 0x3 : 0xc;
 9-	const Uint8 *table = blend_lut[blend][layer >> 6];
10-	const int opaque_mask = opaque_lut[blend];
11+	const int dx = flipx ? -rDY : rDY, dy = flipy ? -rDX : rDX;
12+	const int row_start = flipx ? 0 : 7, row_delta = flipx ? 1 : -1;
13+	const int col_start = flipy ? 7 : 0, col_delta = flipy ? -1 : 1;
14+	const int layer = ctrl & 0x40, layer_mask = layer ? 0x3 : 0xc;
15 	const int is_2bpp = ctrl & 0x80;
16 	const int addr_incr = rMA << (is_2bpp ? 2 : 1);
17-	const int dx = flipx ? -rDY : rDY, dy = flipy ? -rDX : rDX;
18 	const int stride = screen_wmar2;
19-	const int row_start = flipx ? 0 : 7;
20-	const int src_delta = flipy ? -1 : 1;
21-	const int row_delta = flipx ? 1 : -1;
22+	const int blend = ctrl & 0xf;
23+	const int opaque_mask = opaque_lut[blend];
24+	const Uint8 *table = blend_lut[blend][layer >> 6];
25 	for(i = 0; i <= rML; i++, x += dx, y += dy, rA += addr_incr) {
26 		const Uint16 x0 = x + 8, y0 = y + 8;
27 		if(x0 + 8 >= stride || y0 + 8 >= screen_hmar2) continue;
28 		Uint8 *dst = screen_layers + y0 * stride + x0;
29-		const Uint8 *src = &ram[rA + (flipy ? 7 : 0)];
30-		for(j = 0; j < 8; j++, dst += stride, src += src_delta) {
31-			const int ch1 = *src, ch2 = is_2bpp ? (src[8] << 1) : 0;
32+		const Uint8 *col = &ram[rA + col_start];
33+		for(j = 0; j < 8; j++, dst += stride, col += col_delta) {
34+			const int ch1 = *col, ch2 = is_2bpp ? (col[8] << 1) : 0;
35 			Uint8 *d = dst;
36 			for(int px = 0, row = row_start; px < 8; px++, d++, row += row_delta) {
37 				const int bit = 1 << row;