From b95f2f676dff84b38ecbfa8a6a476a1f98b04410 Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Tue, 24 Jan 2006 23:06:36 +0000 Subject: [PATCH] [project @ 2006-01-24 23:06:36 by rjw] Don't decode GIFs until they are required for rendering. svn path=/import/netsurf/; revision=2031 --- image/gif.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/image/gif.c b/image/gif.c index 4b7fd27ba..8ec0a6ef4 100644 --- a/image/gif.c +++ b/image/gif.c @@ -50,7 +50,6 @@ bool nsgif_create(struct content *c, const char *params[]) { warn_user("NoMemory", 0); return false; } - c->data.gif.current_frame = 0; return true; } @@ -65,7 +64,7 @@ bool nsgif_convert(struct content *c, int iwidth, int iheight) { gif = c->data.gif.gif; gif->gif_data = c->source_data; gif->buffer_size = c->source_size; - gif->buffer_position = 0; // Paranoid + gif->buffer_position = 0; /* Initialise the GIF */ @@ -97,20 +96,13 @@ bool nsgif_convert(struct content *c, int iwidth, int iheight) { c->width = gif->width; c->height = gif->height; c->title = malloc(100); - if (c->title) { + if (c->title) snprintf(c->title, 100, messages_get("GIFTitle"), c->width, c->height, c->source_size); - } c->size += (gif->width * gif->height * 4) + 16 + 44 + 100; - /* Initialise the first frame so if we try to use the image data directly prior to - a plot we get some sensible data - */ - gif_decode_frame(c->data.gif.gif, 0); - if (c->data.gif.gif->frame_image) - bitmap_modified(c->data.gif.gif->frame_image); - /* Schedule the animation if we have one */ + c->data.gif.current_frame = 0; if (gif->frame_count_partial > 1) schedule(gif->frames[0].frame_delay, nsgif_animate, c);