summaryrefslogtreecommitdiff
path: root/riscos/gif.c
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2004-05-10 22:14:33 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2004-05-10 22:14:33 +0000
commit47ab606edf911cb376941ab5616d331b017bfe11 (patch)
treef51426a1973cf3d2020692360547c9fc7b1077c5 /riscos/gif.c
parent7fa938d09c3ebbaf00d1a77059c8433876bd6d53 (diff)
downloadnetsurf-47ab606edf911cb376941ab5616d331b017bfe11.tar.gz
netsurf-47ab606edf911cb376941ab5616d331b017bfe11.tar.bz2
[project @ 2004-05-10 22:14:33 by rjw]
Added support for NETSCAPE2.0 application extension for limited looping. GIF decoding attempts all images, irrespective of whether they adhere to the GIF87/GIF89a spec. Disabled logging. svn path=/import/netsurf/; revision=849
Diffstat (limited to 'riscos/gif.c')
-rw-r--r--riscos/gif.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/riscos/gif.c b/riscos/gif.c
index 942ef49e0..9065da2bb 100644
--- a/riscos/gif.c
+++ b/riscos/gif.c
@@ -161,15 +161,30 @@ void nsgif_animate(void *p)
{
struct content *c = p;
union content_msg_data data;
-
- /* at the moment just advance by one frame */
+
+ /* Advance by a frame, updating the loop count accordingly
+ */
c->data.gif.current_frame++;
if (c->data.gif.current_frame == c->data.gif.gif->frame_count) {
c->data.gif.current_frame = 0;
+
+ /* A loop count of 0 has a special meaning of infinite
+ */
+ if (c->data.gif.gif->loop_count != 0) {
+ c->data.gif.gif->loop_count--;
+ if (c->data.gif.gif->loop_count == 0) {
+ c->data.gif.gif->loop_count = -1;
+ }
+ }
}
- schedule(c->data.gif.gif->frames[c->data.gif.current_frame].frame_delay,
- nsgif_animate, c);
+
+ /* 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);
+ }
/* area within gif to redraw */
data.redraw.x = c->data.gif.gif->frames[c->data.gif.current_frame].redraw_x;