(screen) Fixed issue with pixel fill

This commit is contained in:
neauoire 2023-11-18 10:59:40 -08:00
parent 56a17bd878
commit 69cc92496d
2 changed files with 7 additions and 9 deletions

View File

@ -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,6 +255,9 @@ 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;
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);
}

View File

@ -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++]))