Browse code

(screen) Fixed pixel fill bug

neauoire authored on 18/11/2023 18:56:34
Showing 2 changed files
... ...
@@ -49,12 +49,7 @@ screen_fill(Uint8 *layer, int color)
49 49
 void
50 50
 screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
51 51
 {
52
-	int row, x, y, w, h;
53
-	if(!x1 && !y1) {
54
-		screen_fill(layer, color);
55
-		return;
56
-	}
57
-	w = uxn_screen.width, h = uxn_screen.height;
52
+	int row, x, y, w = uxn_screen.width, h = uxn_screen.height;
58 53
 	for(y = y1; y < y2 && y < h; y++)
59 54
 		for(x = x1, row = y * w; x < x2 && x < w; x++)
60 55
 			layer[x + row] = color;
... ...
@@ -125,16 +120,16 @@ screen_debugger(Uxn *u)
125 120
 	int i;
126 121
 	for(i = 0; i < 0x08; i++) {
127 122
 		Uint8 pos = u->wst.ptr - 4 + i;
128
-		Uint8 color = i > 4 ? 0x01 : !pos ? 0xc :
129
-			i == 4                        ? 0x8 :
130
-                                            0x2;
123
+		Uint8 color = i > 4 ? 0x01 : !pos ? 0xc
124
+			: i == 4                      ? 0x8
125
+										  : 0x2;
131 126
 		draw_byte(u->wst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x18, color);
132 127
 	}
133 128
 	for(i = 0; i < 0x08; i++) {
134 129
 		Uint8 pos = u->rst.ptr - 4 + i;
135
-		Uint8 color = i > 4 ? 0x01 : !pos ? 0xc :
136
-			i == 4                        ? 0x8 :
137
-                                            0x2;
130
+		Uint8 color = i > 4 ? 0x01 : !pos ? 0xc
131
+			: i == 4                      ? 0x8
132
+										  : 0x2;
138 133
 		draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, color);
139 134
 	}
140 135
 	screen_1bpp(uxn_screen.fg, &arrow[0], 0x68, uxn_screen.height - 0x20, 3, 1, 1);
... ...
@@ -240,7 +235,10 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
240 235
 			Uint16 x2 = uxn_screen.width, y2 = uxn_screen.height;
241 236
 			if(ctrl & 0x10) x2 = x, x = 0;
242 237
 			if(ctrl & 0x20) y2 = y, y = 0;
243
-			screen_rect(layer, x, y, x2, y2, color);
238
+			if(!x && !y && x2 == uxn_screen.width && y2 == uxn_screen.height)
239
+				screen_fill(layer, color);
240
+			else
241
+				screen_rect(layer, x, y, x2, y2, color);
244 242
 			screen_change(x, y, x2, y2);
245 243
 		}
246 244
 		/* pixel mode */
... ...
@@ -495,7 +495,7 @@ main(int argc, char **argv)
495 495
 	/* Read flag. Right now, there can be only one. */
496 496
 	if(argv[i][0] == '-') {
497 497
 		if(argv[i][1] == 'v')
498
-			return system_version("Uxnemu - Graphical Varvara Emulator", "11 Nov 2023");
498
+			return system_version("Uxnemu - Graphical Varvara Emulator", "18 Nov 2023");
499 499
 		if(argv[i][1] == '-')
500 500
 			i++;
501 501
 		if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)