summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2004-04-26 13:47:51 +0000
committerJames Bursa <james@netsurf-browser.org>2004-04-26 13:47:51 +0000
commit199eee4b0bc2d825d0b48fda3644e81712a2b892 (patch)
treea04d46eee99bdc1a88bc0d176f4d81e863389549
parent330a3bb64c58ff12d8ac7d08de74f3064c670a75 (diff)
downloadnetsurf-199eee4b0bc2d825d0b48fda3644e81712a2b892.tar.gz
netsurf-199eee4b0bc2d825d0b48fda3644e81712a2b892.tar.bz2
[project @ 2004-04-26 13:47:51 by bursa]
Fix scaled GIF animations. svn path=/import/netsurf/; revision=805
-rw-r--r--content/content.h2
-rw-r--r--render/html.c20
-rw-r--r--riscos/gif.c2
-rw-r--r--riscos/window.c16
4 files changed, 28 insertions, 12 deletions
diff --git a/content/content.h b/content/content.h
index ff7742868..b005da848 100644
--- a/content/content.h
+++ b/content/content.h
@@ -85,6 +85,8 @@ union content_msg_data {
struct content *object;
/** Coordinates to plot object at. */
int object_x, object_y;
+ /** Dimensions to plot object with. */
+ int object_width, object_height;
} redraw;
char *auth_realm; /**< Realm, for CONTENT_MSG_AUTH. */
};
diff --git a/render/html.c b/render/html.c
index 9047e661f..376b42ddc 100644
--- a/render/html.c
+++ b/render/html.c
@@ -675,10 +675,22 @@ void html_object_callback(content_msg msg, struct content *object,
case CONTENT_MSG_REDRAW:
box_coords(box, &x, &y);
- data.redraw.x += x;
- data.redraw.y += y;
- data.redraw.object_x += x;
- data.redraw.object_y += y;
+ if (box->object == data.redraw.object) {
+ data.redraw.x = data.redraw.x *
+ box->width / box->object->width;
+ data.redraw.y = data.redraw.y *
+ box->height / box->object->height;
+ data.redraw.width = data.redraw.width *
+ box->width / box->object->width;
+ data.redraw.height = data.redraw.height *
+ box->height / box->object->height;
+ data.redraw.object_width = box->width;
+ data.redraw.object_height = box->height;
+ }
+ data.redraw.x += x + box->padding[LEFT];
+ data.redraw.y += y + box->padding[TOP];
+ data.redraw.object_x += x + box->padding[LEFT];
+ data.redraw.object_y += y + box->padding[TOP];
content_broadcast(c, CONTENT_MSG_REDRAW, data);
break;
diff --git a/riscos/gif.c b/riscos/gif.c
index 6e50889a1..63952342e 100644
--- a/riscos/gif.c
+++ b/riscos/gif.c
@@ -161,6 +161,8 @@ void nsgif_animate(void *p)
data.redraw.object = c;
data.redraw.object_x = 0;
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/window.c b/riscos/window.c
index 15ea21ba6..9a245028a 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -275,10 +275,10 @@ void gui_window_update_box(gui_window *g, const union content_msg_data *data)
wimp_draw update;
update.w = g->window;
- update.box.x0 = data->redraw.x * 2;
- update.box.y0 = -(data->redraw.y + data->redraw.height) * 2;
- update.box.x1 = (data->redraw.x + data->redraw.width) * 2;
- update.box.y1 = -data->redraw.y * 2;
+ 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;
error = xwimp_update_window(&update, &more);
if (error) {
LOG(("xwimp_update_window: 0x%x: %s",
@@ -299,11 +299,11 @@ void gui_window_update_box(gui_window *g, const union content_msg_data *data)
assert(data->redraw.object);
content_redraw(data->redraw.object,
update.box.x0 - update.xscroll +
- data->redraw.object_x * 2,
+ data->redraw.object_x * 2 * g->scale,
update.box.y1 - update.yscroll -
- data->redraw.object_y * 2,
- data->redraw.object->width * 2,
- data->redraw.object->height * 2,
+ data->redraw.object_y * 2 * g->scale,
+ data->redraw.object_width * 2 * g->scale,
+ data->redraw.object_height * 2 * g->scale,
update.clip.x0, update.clip.y0,
update.clip.x1 - 1, update.clip.y1 - 1,
g->scale);