diff options
-rw-r--r-- | riscos/gif.c | 7 | ||||
-rw-r--r-- | riscos/options.h | 8 | ||||
-rw-r--r-- | riscos/window.c | 34 |
3 files changed, 41 insertions, 8 deletions
diff --git a/riscos/gif.c b/riscos/gif.c index e71cdf471..0e7185634 100644 --- a/riscos/gif.c +++ b/riscos/gif.c @@ -161,6 +161,7 @@ void nsgif_animate(void *p) { struct content *c = p; union content_msg_data data; + int delay; /* Advance by a frame, updating the loop count accordingly */ @@ -183,8 +184,9 @@ void nsgif_animate(void *p) /* Continue animating if we should */ if (c->data.gif.gif->loop_count >= 0) { - schedule(c->data.gif.gif->frames[c->data.gif.current_frame].frame_delay, - nsgif_animate, c); + delay = c->data.gif.gif->frames[c->data.gif.current_frame].frame_delay; + if (delay < option_minimum_gif_delay) delay = option_minimum_gif_delay; + schedule(delay, nsgif_animate, c); } /* area within gif to redraw */ @@ -203,6 +205,7 @@ void nsgif_animate(void *p) data.redraw.object_y = 0; data.redraw.object_width = c->width; data.redraw.object_height = c->height; + content_broadcast(c, CONTENT_MSG_REDRAW, data); } diff --git a/riscos/options.h b/riscos/options.h index fa26885ea..7cdcfedb1 100644 --- a/riscos/options.h +++ b/riscos/options.h @@ -39,7 +39,7 @@ extern int option_window_width; extern int option_window_height; extern int option_window_screen_width; extern int option_window_screen_height; - +extern int option_minimum_gif_delay; #define EXTRA_OPTION_DEFINE \ bool option_use_mouse_gestures = false;\ @@ -64,7 +64,8 @@ int option_window_y = 0; \ int option_window_width = 0; \ int option_window_height = 0; \ int option_window_screen_width = 0; \ -int option_window_screen_height = 0; +int option_window_screen_height = 0; \ +int option_minimum_gif_delay = 10; #define EXTRA_OPTION_TABLE \ { "use_mouse_gestures", OPTION_BOOL, &option_use_mouse_gestures },\ @@ -89,6 +90,7 @@ int option_window_screen_height = 0; { "window_width", OPTION_INTEGER, &option_window_width }, \ { "window_height", OPTION_INTEGER, &option_window_height }, \ { "window_screen_width", OPTION_INTEGER, &option_window_screen_width }, \ -{ "window_screen_height", OPTION_INTEGER, &option_window_screen_height } +{ "window_screen_height", OPTION_INTEGER, &option_window_screen_height }, \ +{ "minimum_gif_delay", OPTION_INTEGER, &option_minimum_gif_delay } #endif diff --git a/riscos/window.c b/riscos/window.c index 8a3bcbb57..919994a6b 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -279,12 +279,40 @@ void gui_window_update_box(gui_window *g, const union content_msg_data *data) unsigned long background_colour = 0xffffff; os_error *error; wimp_draw update; - + int size; + int addition_x = 0; + int addition_y = 0; + + /* We must have an object otherwise things go very wrong + */ + assert(data->redraw.object); + + /* Accomodate for rounding errors, minimising the number of those evil division things + */ + if (data->redraw.object_width < data->redraw.object->width) { + addition_x = 1 + (data->redraw.width + 1) * (data->redraw.object->width / data->redraw.object_width) - + data->redraw.width; + } else if (data->redraw.object_width > data->redraw.object->width) { + addition_x = 1; + } + if (data->redraw.object_height < data->redraw.object->height) { + addition_y = 1 + (data->redraw.height + 1) * (data->redraw.object->height / data->redraw.object_height) - + data->redraw.height; + } else if (data->redraw.object_height > data->redraw.object->height) { + addition_y = 1; + } + + /* Calculate the update box, taking care not to exceed our bounds + */ update.w = g->window; update.box.x0 = data->redraw.x * 2 * g->scale; - update.box.y0 = -(data->redraw.y + data->redraw.height) * 2 * g->scale; - update.box.x1 = (data->redraw.x + data->redraw.width) * 2 * g->scale; update.box.y1 = -data->redraw.y * 2 * g->scale; + size = data->redraw.x + data->redraw.width + addition_x; + if (size > (data->redraw.x + data->redraw.object_width)) size = data->redraw.x + data->redraw.object_width; + update.box.x1 = size * 2 * g->scale; + size = data->redraw.y + data->redraw.height + addition_y; + if (size > (data->redraw.y + data->redraw.object_height)) size = data->redraw.y + data->redraw.object_height; + update.box.y0 = -size * 2 * g->scale; error = xwimp_update_window(&update, &more); if (error) { LOG(("xwimp_update_window: 0x%x: %s", |