(screen) Fixed issue with pixel fill
This commit is contained in:
parent
56a17bd878
commit
69cc92496d
|
@ -49,12 +49,7 @@ screen_fill(Uint8 *layer, int color)
|
||||||
void
|
void
|
||||||
screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
|
screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
|
||||||
{
|
{
|
||||||
int row, x, y, w, h;
|
int row, x, y, w = uxn_screen.width, h = uxn_screen.height;
|
||||||
if(!x1 && !y1) {
|
|
||||||
screen_fill(layer, color);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
w = uxn_screen.width, h = uxn_screen.height;
|
|
||||||
for(y = y1; y < y2 && y < h; y++)
|
for(y = y1; y < y2 && y < h; y++)
|
||||||
for(x = x1, row = y * w; x < x2 && x < w; x++)
|
for(x = x1, row = y * w; x < x2 && x < w; x++)
|
||||||
layer[x + row] = color;
|
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;
|
Uint16 x2 = uxn_screen.width, y2 = uxn_screen.height;
|
||||||
if(ctrl & 0x10) x2 = x, x = 0;
|
if(ctrl & 0x10) x2 = x, x = 0;
|
||||||
if(ctrl & 0x20) y2 = y, y = 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_rect(layer, x, y, x2, y2, color);
|
||||||
screen_change(x, y, x2, y2);
|
screen_change(x, y, x2, y2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,7 +280,7 @@ main(int argc, char **argv)
|
||||||
return system_error("usage", "uxn11 [-v] file.rom [args...]");
|
return system_error("usage", "uxn11 [-v] file.rom [args...]");
|
||||||
/* Read flags */
|
/* Read flags */
|
||||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
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())
|
if(!emu_init())
|
||||||
return system_error("Init", "Failed to initialize varvara.");
|
return system_error("Init", "Failed to initialize varvara.");
|
||||||
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
||||||
|
|
Loading…
Reference in New Issue