commit 69cc924
neauoire
·
2023-11-18 18:59:40 +0000 UTC
parent 56a17bd
(screen) Fixed issue with pixel fill
2 files changed,
+7,
-9
+5,
-7
1@@ -49,12 +49,7 @@ screen_fill(Uint8 *layer, int color)
2 void
3 screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
4 {
5- int row, x, y, w, h;
6- if(!x1 && !y1) {
7- screen_fill(layer, color);
8- return;
9- }
10- w = uxn_screen.width, h = uxn_screen.height;
11+ int row, x, y, w = uxn_screen.width, h = uxn_screen.height;
12 for(y = y1; y < y2 && y < h; y++)
13 for(x = x1, row = y * w; x < x2 && x < w; x++)
14 layer[x + row] = color;
15@@ -260,7 +255,10 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
16 Uint16 x2 = uxn_screen.width, y2 = uxn_screen.height;
17 if(ctrl & 0x10) x2 = x, x = 0;
18 if(ctrl & 0x20) y2 = y, y = 0;
19- screen_rect(layer, x, y, x2, y2, color);
20+ if(!x && !y && x2 == uxn_screen.width && y2 == uxn_screen.height)
21+ screen_fill(layer, color);
22+ else
23+ screen_rect(layer, x, y, x2, y2, color);
24 screen_change(x, y, x2, y2);
25 }
26 /* pixel mode */
+2,
-2
1@@ -142,7 +142,7 @@ static void
2 toggle_scale(Uxn *u)
3 {
4 int s = uxn_screen.scale + 1;
5- if (s > 3) s = 1;
6+ if(s > 3) s = 1;
7 screen_resize(uxn_screen.width, uxn_screen.height, s);
8 }
9
10@@ -280,7 +280,7 @@ main(int argc, char **argv)
11 return system_error("usage", "uxn11 [-v] file.rom [args...]");
12 /* Read flags */
13 if(argv[i][0] == '-' && argv[i][1] == 'v')
14- return system_version("Uxn11 - Graphical Varvara Emulator", "12 Nov 2023");
15+ return system_version("Uxn11 - Graphical Varvara Emulator", "18 Nov 2023");
16 if(!emu_init())
17 return system_error("Init", "Failed to initialize varvara.");
18 if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))