From 69cc92496ddfa53075c056fd672d65b1ef3cfb37 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sat, 18 Nov 2023 10:59:40 -0800 Subject: [PATCH] (screen) Fixed issue with pixel fill --- src/devices/screen.c | 12 +++++------- src/uxn11.c | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/devices/screen.c b/src/devices/screen.c index 54a67ec..d1b9475 100644 --- a/src/devices/screen.c +++ b/src/devices/screen.c @@ -49,12 +49,7 @@ screen_fill(Uint8 *layer, int color) void screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color) { - int row, x, y, w, h; - if(!x1 && !y1) { - screen_fill(layer, color); - return; - } - w = uxn_screen.width, h = uxn_screen.height; + int row, x, y, w = uxn_screen.width, h = uxn_screen.height; for(y = y1; y < y2 && y < h; y++) for(x = x1, row = y * w; x < x2 && x < w; x++) layer[x + row] = color; @@ -260,7 +255,10 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port) Uint16 x2 = uxn_screen.width, y2 = uxn_screen.height; if(ctrl & 0x10) x2 = x, x = 0; if(ctrl & 0x20) y2 = y, y = 0; - screen_rect(layer, x, y, x2, y2, color); + if(!x && !y && x2 == uxn_screen.width && y2 == uxn_screen.height) + screen_fill(layer, color); + else + screen_rect(layer, x, y, x2, y2, color); screen_change(x, y, x2, y2); } /* pixel mode */ diff --git a/src/uxn11.c b/src/uxn11.c index a672b40..ba71427 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -142,7 +142,7 @@ static void toggle_scale(Uxn *u) { int s = uxn_screen.scale + 1; - if (s > 3) s = 1; + if(s > 3) s = 1; screen_resize(uxn_screen.width, uxn_screen.height, s); } @@ -280,7 +280,7 @@ main(int argc, char **argv) return system_error("usage", "uxn11 [-v] file.rom [args...]"); /* Read flags */ if(argv[i][0] == '-' && argv[i][1] == 'v') - return system_version("Uxn11 - Graphical Varvara Emulator", "12 Nov 2023"); + return system_version("Uxn11 - Graphical Varvara Emulator", "18 Nov 2023"); if(!emu_init()) return system_error("Init", "Failed to initialize varvara."); if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))