summaryrefslogtreecommitdiff
path: root/riscos/gif.c
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2004-05-09 16:12:24 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2004-05-09 16:12:24 +0000
commitf29ad7e2662ff12d2c07c261c5c4e77ce0ac87c5 (patch)
tree82e798a6fb12fb91f0a9b318267620ab30ffe192 /riscos/gif.c
parent29340cf8c8e2fe2f0fe8155e45940da29c37b79e (diff)
downloadnetsurf-f29ad7e2662ff12d2c07c261c5c4e77ce0ac87c5.tar.gz
netsurf-f29ad7e2662ff12d2c07c261c5c4e77ce0ac87c5.tar.bz2
[project @ 2004-05-09 16:12:24 by rjw]
Improved GIF animation and a decoding bug fix. svn path=/import/netsurf/; revision=845
Diffstat (limited to 'riscos/gif.c')
-rw-r--r--riscos/gif.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/riscos/gif.c b/riscos/gif.c
index 2b227af6d..9bf5b0586 100644
--- a/riscos/gif.c
+++ b/riscos/gif.c
@@ -63,6 +63,10 @@ int nsgif_convert(struct content *c, unsigned int iwidth, unsigned int iheight)
*/
gif_initialise(gif);
+ /* Abort on bad GIFs
+ */
+ if ((gif->frame_count_partial == 0) || (gif->width == 0) || (gif->height == 0)) return 1;
+
/* Store our content width
*/
c->width = gif->width;
@@ -71,7 +75,7 @@ int nsgif_convert(struct content *c, unsigned int iwidth, unsigned int iheight)
/* Schedule the animation if we have one
*/
if (gif->frame_count > 1) {
- schedule(gif->frame_delays[0], nsgif_animate, c);
+ schedule(gif->frames[0].frame_delay, nsgif_animate, c);
}
/* Exit as a success
@@ -89,6 +93,10 @@ void nsgif_redraw(struct content *c, long x, long y,
int previous_frame;
unsigned int frame;
+ /* Reject no images (paranoia)
+ */
+ if (c->data.gif.gif->frame_count_partial < 1) return;
+
/* Decode from the last frame to the current frame
*/
if (c->data.gif.current_frame < c->data.gif.gif->decoded_frame)
@@ -145,17 +153,18 @@ void nsgif_animate(void *p)
*/ c->data.gif.current_frame = 0;
}
- schedule(c->data.gif.gif->frame_delays[c->data.gif.current_frame],
+ schedule(c->data.gif.gif->frames[c->data.gif.current_frame].frame_delay,
nsgif_animate, c);
/* area within gif to redraw (currently whole gif) */
- data.redraw.x = 0;
- data.redraw.y = 0;
- data.redraw.width = c->width;
- data.redraw.height = c->height;
+ data.redraw.x = c->data.gif.gif->frames[c->data.gif.current_frame].redraw_x;
+ data.redraw.y = c->data.gif.gif->frames[c->data.gif.current_frame].redraw_y;
+ data.redraw.width = c->data.gif.gif->frames[c->data.gif.current_frame].redraw_width;
+ data.redraw.height = c->data.gif.gif->frames[c->data.gif.current_frame].redraw_height;
/* redraw background (true) or plot on top (false) */
- data.redraw.full_redraw = false;
+ data.redraw.full_redraw =
+ c->data.gif.gif->frames[c->data.gif.current_frame].redraw_required;
/* other data */
data.redraw.object = c;