diff options
author | Jonathan Blandford <jrb@redhat.com> | 2000-01-07 18:29:13 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2000-01-07 18:29:13 +0000 |
commit | 84c85a1a11142bf559f21dbeeb5867b7fc463a57 (patch) | |
tree | 3a8aa92e9f24135ef6b7369ea355731ea1cad377 /gdk-pixbuf/io-gif.c | |
parent | 0e86d28026954078cec6a078ee645bf39b7c4699 (diff) | |
download | gdk-pixbuf-84c85a1a11142bf559f21dbeeb5867b7fc463a57.tar.gz |
Added progressive animation loading. Added progressive animation loading.
2000-01-07 Jonathan Blandford <jrb@redhat.com>
* gdk-pixbuf/gdk-pixbuf-io.c: Added progressive animation loading.
* gdk-pixbuf/gdk-pixbuf-io.h: Added progressive animation loading.
* gdk-pixbuf/gdk-pixbuf-loader.c: Added progressive animation
loading.
* gdk-pixbuf/gdk-pixbuf-loader.h: Added progressive animation
loading.
* gdk-pixbuf/io-gif.c (image_load_increment): I think the
ref-counting mess is finally fixed. Added progressive animation
loading.
I think progressive animation loading all works now. It's all
documented too, if anyone wants to play with it.
Diffstat (limited to 'gdk-pixbuf/io-gif.c')
-rw-r--r-- | gdk-pixbuf/io-gif.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index 13a66cfba..1ba894dda 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -42,6 +42,7 @@ * -2 -> failure; abort the load * -3 -> control needs to be passed back to the main loop * \_ (most of the time returning 0 will get this, but not always) + * * >1 -> for functions that get a guchar, the char will be returned. * * -jrb (11/03/1999) @@ -129,6 +130,8 @@ struct _GifContext /* progressive read, only. */ ModulePreparedNotifyFunc prepare_func; ModuleUpdatedNotifyFunc update_func; + ModuleFrameDoneNotifyFunc frame_done_func; + ModuleAnimationDoneNotifyFunc anim_done_func; gpointer user_data; guchar *buf; guint ptr; @@ -670,7 +673,7 @@ gif_get_lzw (GifContext *context) if (context->prepare_func) (* context->prepare_func) (context->pixbuf, context->user_data); - if (context->animation) { + if (context->animation || context->frame_done_func) { context->frame = g_new (GdkPixbufFrame, 1); context->frame->x_offset = 0; context->frame->y_offset = 0; @@ -691,8 +694,10 @@ gif_get_lzw (GifContext *context) break; } context->frame->pixbuf = context->pixbuf; - context->animation->n_frames ++; - context->animation->frames = g_list_append (context->animation->frames, context->frame); + if (context->animation) { + context->animation->n_frames ++; + context->animation->frames = g_list_append (context->animation->frames, context->frame); + } } } dest = gdk_pixbuf_get_pixels (context->pixbuf); @@ -816,6 +821,10 @@ gif_get_lzw (GifContext *context) } if (context->animation && context->state == GIF_GET_NEXT_STEP) { + (* context->frame_done_func) (context->frame, + context->user_data); + + gdk_pixbuf_unref (context->pixbuf); context->pixbuf = NULL; context->frame = NULL; } @@ -1059,6 +1068,8 @@ new_context (void) context->state = GIF_START; context->prepare_func = NULL; context->update_func = NULL; + context->frame_done_func = NULL; + context->anim_done_func = NULL; context->user_data = NULL; context->buf = NULL; context->amount_needed = 0; @@ -1099,6 +1110,8 @@ image_begin_load (ModulePreparedNotifyFunc prepare_func, context = new_context (); context->prepare_func = prepare_func; context->update_func = update_func; + context->frame_done_func = frame_done_func; + context->anim_done_func = anim_done_func; context->user_data = user_data; return (gpointer) context; @@ -1113,7 +1126,9 @@ image_stop_load (gpointer data) if (context->pixbuf) gdk_pixbuf_unref (context->pixbuf); -/* g_free (context->buf); */ + if (context->animation) + gdk_pixbuf_animation_unref (context->animation); +/* g_free (context->buf);*/ g_free (context); } |