1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-14 07:30:21 +00:00

Keep damage notification boundaries within the current screen

On startup, bitblt calls may be made for the original screen size
and if the new screen size is smaller than that, we must ensure
that damage notifications are contained within the new screen.

Move definition of min() so we can use it in sdl_notify_damage()
This commit is contained in:
Nick Briggs 2021-11-08 18:16:14 -08:00
parent 0e731ce02d
commit a2f8f23152

View File

@ -199,6 +199,12 @@ void DoRing() {
if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T;
}
static int min(int a, int b) {
if(a < b)
return a;
return b;
}
static int should_update_texture = 0;
static int min_x = 0;
@ -211,9 +217,9 @@ void sdl_notify_damage(int x, int y, int w, int h) {
if(y < min_y)
min_y = y;
if(x + w > max_x)
max_x = x + w;
max_x = min(x + w, sdl_displaywidth - 1);
if(y + h > max_y)
max_y = y + h;
max_y = min(y + h, sdl_displayheight - 1);
should_update_texture = 1;
}
@ -388,11 +394,6 @@ static void sdl_update_viewport(int width, int height) {
SDL_RenderSetViewport(sdl_renderer, &r);
printf("new viewport: %d / %d\n", w, h);
}
static int min(int a, int b) {
if(a < b)
return a;
return b;
}
static int last_draw = 0;
static int last_keystate[512] = { 0 };
/* void handle_keyboard() { */