commit 690f89b

Devine Lu Linvega  ·  2024-11-25 18:29:48 +0000 UTC
parent fbde47f
(screen) Cleanup
1 files changed,  +8, -10
+8, -10
 1@@ -32,13 +32,12 @@ static void
 2 screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 blend, int fx, int fy)
 3 {
 4 	int x, y, opaque = (blend % 5);
 5-	Uint16 top = y1, bottom = y1 + 8, left = x1, right = x1 + 8, offx = 0, offy = 0;
 6-	for(y = top; y < bottom; y++) {
 7-		int ptr = fy < 0 ? 7 - (y - top) : y - top + offy * fy;
 8+	for(y = y1; y < y1 + 8; y++) {
 9+		int ptr = fy < 0 ? 7 - (y - y1) : y - y1 * fy;
10 		int ch1 = addr[ptr], ch2 = addr[ptr + 8];
11 		int row = y * MAR2(uxn_screen.width);
12-		for(x = left; x < right; x++) {
13-			int shift = (fx > 0 ? 7 - (x - left) : x - left) + offx;
14+		for(x = x1; x < x1 + 8; x++) {
15+			int shift = (fx > 0 ? 7 - (x - x1) : x - x1);
16 			int color = ((ch1 >> shift) & 1) | (((ch2 >> shift) & 1) << 1);
17 			if(opaque || color)
18 				layer[x + row] = blending[color][blend];
19@@ -50,13 +49,12 @@ static void
20 screen_1bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 blend, int fx, int fy)
21 {
22 	int x, y, opaque = (blend % 5);
23-	Uint16 top = y1, bottom = y1 + 8, left = x1, right = x1 + 8, offx = 0, offy = 0;
24-	for(y = top; y < bottom; y++) {
25-		int ptr = fy < 0 ? 7 - (y - top) : y - top + offy * fy;
26+	for(y = y1; y < y1 + 8; y++) {
27+		int ptr = fy < 0 ? 7 - (y - y1) : y - y1;
28 		int ch1 = addr[ptr];
29 		int row = y * MAR2(uxn_screen.width);
30-		for(x = left; x < right; x++) {
31-			int shift = fx > 0 ? 7 - (x - left) : x - left + offx;
32+		for(x = x1; x < x1 + 8; x++) {
33+			int shift = fx > 0 ? 7 - (x - x1) : x - x1;
34 			int color = (ch1 >> shift) & 1;
35 			if(opaque || color)
36 				layer[x + row] = blending[color][blend];