diff options
author | Richard Wilson <rjw@netsurf-browser.org> | 2004-05-24 20:50:57 +0000 |
---|---|---|
committer | Richard Wilson <rjw@netsurf-browser.org> | 2004-05-24 20:50:57 +0000 |
commit | 1d7517629358ebc946532306497843a7ff7806b8 (patch) | |
tree | 1718f786215466cab9e47d2de55f14c540c335c0 /riscos/window.c | |
parent | b28605cd5faa64b5bc4ac302c26a488b3cf547bf (diff) | |
download | netsurf-1d7517629358ebc946532306497843a7ff7806b8.tar.gz netsurf-1d7517629358ebc946532306497843a7ff7806b8.tar.bz2 |
[project @ 2004-05-24 20:50:57 by rjw]
Added option for maximum GIF animation speed (currently defaults to 10cs).
Fix for scaled animations not being correctly updated due to rounding issues.
svn path=/import/netsurf/; revision=895
Diffstat (limited to 'riscos/window.c')
-rw-r--r-- | riscos/window.c | 34 |
1 files changed, 31 insertions, 3 deletions
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", |