commit a4ff15e

neauoire  ·  2023-11-13 00:40:09 +0000 UTC
parent a9bf231
Reduce redraws
1 files changed,  +12, -10
+12, -10
 1@@ -69,11 +69,12 @@ screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16
 2 	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
 3 	for(y = y1 + ymod; y != ymax; y += fy) {
 4 		Uint16 c = *ch1++ | (*ch2++ << 8);
 5-		for(x = x1 + xmod; x != xmax; x -= fx, c >>= 1) {
 6-			Uint8 ch = (c & 1) | ((c >> 7) & 2);
 7-			if((opaque || ch) && x < w && y < h)
 8-				layer[x + y * w] = blending[ch][color];
 9-		}
10+		if(y < h)
11+			for(x = x1 + xmod; x != xmax; x -= fx, c >>= 1) {
12+				Uint8 ch = (c & 1) | ((c >> 7) & 2);
13+				if((opaque || ch) && x < w)
14+					layer[x + y * w] = blending[ch][color];
15+			}
16 	}
17 }
18 
19@@ -86,11 +87,12 @@ screen_1bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16
20 	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
21 	for(y = y1 + ymod; y != ymax; y += fy) {
22 		Uint16 c = *ch1++;
23-		for(x = x1 + xmod; x != xmax; x -= fx, c >>= 1) {
24-			Uint8 ch = c & 1;
25-			if((opaque || ch) && x < w && y < h)
26-				layer[x + y * w] = blending[ch][color];
27-		}
28+		if(y < h)
29+			for(x = x1 + xmod; x != xmax; x -= fx, c >>= 1) {
30+				Uint8 ch = c & 1;
31+				if((opaque || ch) && x < w)
32+					layer[x + y * w] = blending[ch][color];
33+			}
34 	}
35 }
36