summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2006-03-14 21:32:16 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2006-03-14 21:32:16 +0000
commit33b9a8d19ba9f3d320b1fbf750366cfe98c1009c (patch)
tree68d64a287e908a4edb1861a833800926251ab308 /gdk-pixbuf
parentf50363d3fa90c07deedcee0a76294ec1750692e2 (diff)
downloadgdk-pixbuf-33b9a8d19ba9f3d320b1fbf750366cfe98c1009c.tar.gz
Add a shortcut to stop the gif mainloop after the first frame, if that is
2006-03-14 Matthias Clasen <mclasen@redhat.com> * io-gif.c (gdk_pixbuf__gif_image_load): Add a shortcut to stop the gif mainloop after the first frame, if that is all we are interested in. (#334538)
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/ChangeLog6
-rw-r--r--gdk-pixbuf/io-gif.c10
2 files changed, 14 insertions, 2 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 0a5245809..a6f602ed6 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-14 Matthias Clasen <mclasen@redhat.com>
+
+ * io-gif.c (gdk_pixbuf__gif_image_load): Add a shortcut
+ to stop the gif mainloop after the first frame, if that
+ is all we are interested in. (#334538)
+
2006-03-03 Matthias Clasen <mclasen@redhat.com>
* io-pnm.c: Support pnm files with maxval > 255.
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index b403d6fa5..886ef9a59 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -117,6 +117,7 @@ struct _GifContext
unsigned int global_bit_pixel;
unsigned int global_color_resolution;
unsigned int background_index;
+ gboolean stop_after_first_frame;
gboolean frame_cmap_active;
CMap frame_color_map;
@@ -1088,6 +1089,9 @@ gif_get_lzw (GifContext *context)
*/
context->frame = NULL;
context->frame_cmap_active = FALSE;
+
+ if (context->stop_after_first_frame)
+ context->state = GIF_DONE;
}
return v;
@@ -1415,7 +1419,7 @@ new_context (void)
memset (context, 0, sizeof (GifContext));
- context->animation = g_object_new (GDK_TYPE_PIXBUF_GIF_ANIM, NULL);
+ context->animation = g_object_new (GDK_TYPE_PIXBUF_GIF_ANIM, NULL);
context->frame = NULL;
context->file = NULL;
context->state = GIF_START;
@@ -1430,6 +1434,7 @@ new_context (void)
context->gif89.disposal = -1;
context->animation->loop = 1;
context->in_loop_extension = FALSE;
+ context->stop_after_first_frame = FALSE;
return context;
}
@@ -1454,7 +1459,8 @@ gdk_pixbuf__gif_image_load (FILE *file, GError **error)
context->file = file;
context->error = error;
-
+ context->stop_after_first_frame = TRUE;
+
if (gif_main_loop (context) == -1 || context->animation->frames == NULL) {
if (context->error && *(context->error) == NULL)
g_set_error (context->error,