diff options
author | Jonathan Blandford <jrb@redhat.com> | 2000-01-05 23:06:13 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2000-01-05 23:06:13 +0000 |
commit | 8f48c4b3cd6cf0643a7a1703de0f2c886a749228 (patch) | |
tree | d780b88df6408d21e976083b57d35f3ce32f7c34 | |
parent | cc76a598ba1069e68a7afce20423d5ddd4f7ecb2 (diff) | |
download | gdk-pixbuf-8f48c4b3cd6cf0643a7a1703de0f2c886a749228.tar.gz |
Change the order of the update func to make it more compatible with the
2000-01-05 Jonathan Blandford <jrb@redhat.com>
* gdk-pixbuf/gdk-pixbuf-io.h: Change the order of the update func
to make it more compatible with the rest of GTK. Added animation
framework for progressive loading.
* gdk-pixbuf/io-bmp.c (image_begin_load): Modified to handle new
system.
* gdk-pixbuf/io-ico.c (image_begin_load): ditto
* gdk-pixbuf/io-png.c (image_begin_load): ditto
* gdk-pixbuf/io-ras.c (image_begin_load): ditto
* gdk-pixbuf/io-jpeg.c (image_begin_load): ditto
* gdk-pixbuf/io-pnm.c (image_begin_load): ditto
* gdk-pixbuf/io-tiff.c (image_begin_load): ditto
* gdk-pixbuf/io-gif.c (image_begin_load): ditto
-rw-r--r-- | gdk-pixbuf/ChangeLog | 16 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-io.h | 16 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-loader.c | 4 | ||||
-rw-r--r-- | gdk-pixbuf/io-bmp.c | 16 | ||||
-rw-r--r-- | gdk-pixbuf/io-gif.c | 18 | ||||
-rw-r--r-- | gdk-pixbuf/io-ico.c | 16 | ||||
-rw-r--r-- | gdk-pixbuf/io-jpeg.c | 17 | ||||
-rw-r--r-- | gdk-pixbuf/io-png.c | 22 | ||||
-rw-r--r-- | gdk-pixbuf/io-pnm.c | 17 | ||||
-rw-r--r-- | gdk-pixbuf/io-ras.c | 16 | ||||
-rw-r--r-- | gdk-pixbuf/io-tiff.c | 4 | ||||
-rw-r--r-- | gtk/gdk-pixbuf-loader.c | 4 |
12 files changed, 115 insertions, 51 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 0e92c68a7..6a109b6bf 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,19 @@ +2000-01-05 Jonathan Blandford <jrb@redhat.com> + + * gdk-pixbuf/gdk-pixbuf-io.h: Change the order of the update func + to make it more compatible with the rest of GTK. Added animation + framework for progressive loading. + + * gdk-pixbuf/io-bmp.c (image_begin_load): Modified to handle new + system. + * gdk-pixbuf/io-ico.c (image_begin_load): ditto + * gdk-pixbuf/io-png.c (image_begin_load): ditto + * gdk-pixbuf/io-ras.c (image_begin_load): ditto + * gdk-pixbuf/io-jpeg.c (image_begin_load): ditto + * gdk-pixbuf/io-pnm.c (image_begin_load): ditto + * gdk-pixbuf/io-tiff.c (image_begin_load): ditto + * gdk-pixbuf/io-gif.c (image_begin_load): ditto + 2000-01-05 Owen Taylor <otaylor@redhat.com> * gdk-pixbuf/pixops/README: Added a README with a TODO diff --git a/gdk-pixbuf/gdk-pixbuf-io.h b/gdk-pixbuf/gdk-pixbuf-io.h index 966768f1a..e6ba541c0 100644 --- a/gdk-pixbuf/gdk-pixbuf-io.h +++ b/gdk-pixbuf/gdk-pixbuf-io.h @@ -1,4 +1,5 @@ -/* GdkPixbuf library - Io handling +/* GdkPixbuf library - Io handling. This is an internal header for gdk-pixbuf. + * You should never use it unless you are doing developement for gdkpixbuf itself. * * Copyright (C) 1999 The Free Software Foundation * @@ -38,9 +39,16 @@ extern "C" { typedef void (* ModulePreparedNotifyFunc) (GdkPixbuf *pixbuf, gpointer user_data); -typedef void (* ModuleUpdatedNotifyFunc) (GdkPixbuf *pixbuf, gpointer user_data, +typedef void (* ModuleUpdatedNotifyFunc) (GdkPixbuf *pixbuf, guint x, guint y, - guint width, guint height); + guint width, guint height, + gpointer user_data); +/* Needed only for animated images. */ +typedef void (* ModuleFrameDoneNotifyFunc) (GdkPixbuf *pixbuf, + gint frame, + gpointer user_data); +typedef void (* ModuleAnimationDoneNotifyFunc) (GdkPixbuf *pixbuf, + gpointer user_data); typedef struct _GdkPixbufModule GdkPixbufModule; struct _GdkPixbufModule { @@ -54,6 +62,8 @@ struct _GdkPixbufModule { gpointer (* begin_load) (ModulePreparedNotifyFunc prepare_func, ModuleUpdatedNotifyFunc update_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, gpointer user_data); void (* stop_load) (gpointer context); gboolean (* load_increment) (gpointer context, const guchar *buf, guint size); diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c index 3d2243662..cd1b91418 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.c +++ b/gdk-pixbuf/gdk-pixbuf-loader.c @@ -222,7 +222,7 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader) } static void -gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, gpointer loader, guint x, guint y, guint width, guint height) +gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, guint x, guint y, guint width, guint height, gpointer loader) { GdkPixbufLoaderPrivate *priv = NULL; @@ -276,7 +276,7 @@ gdk_pixbuf_loader_load_module(GdkPixbufLoader *loader) return 0; } - priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, gdk_pixbuf_loader_update, loader); + priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, gdk_pixbuf_loader_update, NULL, NULL, loader); if (priv->context == NULL) { g_warning("Failed to begin progressive load"); diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c index ebce8d7b7..65d65f1be 100644 --- a/gdk-pixbuf/io-bmp.c +++ b/gdk-pixbuf/io-bmp.c @@ -173,7 +173,10 @@ struct bmp_progressive_state { gpointer image_begin_load(ModulePreparedNotifyFunc prepared_func, - ModuleUpdatedNotifyFunc updated_func, gpointer user_data); + ModuleUpdatedNotifyFunc updated_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, + gpointer user_data); void image_stop_load(gpointer data); gboolean image_load_increment(gpointer data, guchar * buf, guint size); @@ -189,7 +192,7 @@ GdkPixbuf *image_load(FILE * f) GdkPixbuf *pb; - State = image_begin_load(NULL, NULL, NULL); + State = image_begin_load(NULL, NULL, NULL, NULL, NULL); membuf = g_malloc(4096); g_assert(membuf != NULL); @@ -303,7 +306,10 @@ static void DecodeHeader(unsigned char *BFH, unsigned char *BIH, gpointer image_begin_load(ModulePreparedNotifyFunc prepared_func, - ModuleUpdatedNotifyFunc updated_func, gpointer user_data) + ModuleUpdatedNotifyFunc updated_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, + gpointer user_data) { struct bmp_progressive_state *context; @@ -529,11 +535,11 @@ static void OneLine(struct bmp_progressive_state *context) if (context->updated_func != NULL) { (*context->updated_func) (context->pixbuf, - context->user_data, 0, context->Lines, context->Header.width, - context->Header.height); + context->Header.height, + context->user_data); } } diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index 467df0682..13a66cfba 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -786,31 +786,31 @@ gif_get_lzw (GifContext *context) if (lower_bound <= upper_bound && first_pass == context->draw_pass) { (* context->update_func) (context->pixbuf, - context->user_data, 0, lower_bound, gdk_pixbuf_get_width (context->pixbuf), - upper_bound - lower_bound); + upper_bound - lower_bound, + context->user_data); } else { if (lower_bound <= upper_bound) { (* context->update_func) (context->pixbuf, - context->user_data, 0, 0, gdk_pixbuf_get_width (context->pixbuf), - gdk_pixbuf_get_height (context->pixbuf)); + gdk_pixbuf_get_height (context->pixbuf), + context->user_data); } else { (* context->update_func) (context->pixbuf, - context->user_data, 0, 0, gdk_pixbuf_get_width (context->pixbuf), - upper_bound); + upper_bound, + context->user_data); (* context->update_func) (context->pixbuf, - context->user_data, 0, lower_bound, gdk_pixbuf_get_width (context->pixbuf), - gdk_pixbuf_get_height (context->pixbuf)); + gdk_pixbuf_get_height (context->pixbuf), + context->user_data); } } } @@ -1087,6 +1087,8 @@ image_load (FILE *file) gpointer image_begin_load (ModulePreparedNotifyFunc prepare_func, ModuleUpdatedNotifyFunc update_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, gpointer user_data) { GifContext *context; diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c index 052c74a9c..22d1769ee 100644 --- a/gdk-pixbuf/io-ico.c +++ b/gdk-pixbuf/io-ico.c @@ -154,7 +154,10 @@ struct ico_progressive_state { gpointer image_begin_load(ModulePreparedNotifyFunc prepared_func, - ModuleUpdatedNotifyFunc updated_func, gpointer user_data); + ModuleUpdatedNotifyFunc updated_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, + gpointer user_data); void image_stop_load(gpointer data); gboolean image_load_increment(gpointer data, guchar * buf, guint size); @@ -170,7 +173,7 @@ GdkPixbuf *image_load(FILE * f) GdkPixbuf *pb; - State = image_begin_load(NULL, NULL, NULL); + State = image_begin_load(NULL, NULL, NULL, NULL, NULL); membuf = g_malloc(4096); g_assert(membuf != NULL); @@ -363,7 +366,10 @@ static void DecodeHeader(guchar *Data, gint Bytes, gpointer image_begin_load(ModulePreparedNotifyFunc prepared_func, - ModuleUpdatedNotifyFunc updated_func, gpointer user_data) + ModuleUpdatedNotifyFunc updated_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, + gpointer user_data) { struct ico_progressive_state *context; @@ -609,11 +615,11 @@ static void OneLine(struct ico_progressive_state *context) if (context->updated_func != NULL) { (*context->updated_func) (context->pixbuf, - context->user_data, 0, context->Lines, context->Header.width, - context->Header.height); + context->Header.height, + context->user_data); } } diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c index 68660d4c7..4cea124e0 100644 --- a/gdk-pixbuf/io-jpeg.c +++ b/gdk-pixbuf/io-jpeg.c @@ -89,7 +89,10 @@ typedef struct { GdkPixbuf *image_load (FILE *f); gpointer image_begin_load (ModulePreparedNotifyFunc func, - ModuleUpdatedNotifyFunc func2, gpointer user_data); + ModuleUpdatedNotifyFunc func2, + ModuleFrameDoneNotifyFunc func3, + ModuleAnimationDoneNotifyFunc func4, + gpointer user_data); void image_stop_load (gpointer context); gboolean image_load_increment(gpointer context, guchar *buf, guint size); @@ -274,6 +277,8 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes) gpointer image_begin_load (ModulePreparedNotifyFunc prepared_func, ModuleUpdatedNotifyFunc updated_func, + ModuleFrameDoneNotifyFunc frame_func, + ModuleAnimationDoneNotifyFunc anim_done_func, gpointer user_data) { JpegProgContext *context; @@ -508,11 +513,11 @@ image_load_increment (gpointer data, guchar *buf, guint size) /* send updated signal */ (* context->updated_func) (context->pixbuf, - context->user_data, - 0, - cinfo->output_scanline-1, - cinfo->image_width, - nlines); + 0, + cinfo->output_scanline-1, + cinfo->image_width, + nlines, + context->user_data); #undef DEBUG_JPEG_PROGRESSIVE #ifdef DEBUG_JPEG_PROGRESSIVE diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c index 75e456144..84a2a0acb 100644 --- a/gdk-pixbuf/io-png.c +++ b/gdk-pixbuf/io-png.c @@ -276,6 +276,8 @@ struct _LoadContext { gpointer image_begin_load (ModulePreparedNotifyFunc prepare_func, ModuleUpdatedNotifyFunc update_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, gpointer user_data) { LoadContext* lc; @@ -367,34 +369,38 @@ image_load_increment(gpointer context, guchar *buf, guint size) if (pass_diff == 0) { /* start and end row were in the same pass */ - (lc->update_func)(lc->pixbuf, lc->notify_user_data, 0, + (lc->update_func)(lc->pixbuf, 0, lc->first_row_seen_in_chunk, lc->pixbuf->art_pixbuf->width, (lc->last_row_seen_in_chunk - - lc->first_row_seen_in_chunk) + 1); + lc->first_row_seen_in_chunk) + 1, + lc->notify_user_data); } else if (pass_diff == 1) { /* We have from the first row seen to the end of the image (max row seen), then from the top of the image to the last row seen */ /* first row to end */ - (lc->update_func)(lc->pixbuf, lc->notify_user_data, 0, + (lc->update_func)(lc->pixbuf, 0, lc->first_row_seen_in_chunk, lc->pixbuf->art_pixbuf->width, (lc->max_row_seen_in_chunk - - lc->first_row_seen_in_chunk) + 1); + lc->first_row_seen_in_chunk) + 1, + lc->notify_user_data); /* top to last row */ - (lc->update_func)(lc->pixbuf, lc->notify_user_data, + (lc->update_func)(lc->pixbuf, 0, 0, lc->pixbuf->art_pixbuf->width, - lc->last_row_seen_in_chunk + 1); + lc->last_row_seen_in_chunk + 1, + lc->notify_user_data); } else { /* We made at least one entire pass, so update the whole image */ - (lc->update_func)(lc->pixbuf, lc->notify_user_data, + (lc->update_func)(lc->pixbuf, 0, 0, lc->pixbuf->art_pixbuf->width, - lc->max_row_seen_in_chunk + 1); + lc->max_row_seen_in_chunk + 1, + lc->notify_user_data); } } diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c index e1cdd5f5d..6d61db91b 100644 --- a/gdk-pixbuf/io-pnm.c +++ b/gdk-pixbuf/io-pnm.c @@ -77,7 +77,10 @@ typedef struct { GdkPixbuf *image_load (FILE *f); gpointer image_begin_load (ModulePreparedNotifyFunc func, - ModuleUpdatedNotifyFunc func2, gpointer user_data); + ModuleUpdatedNotifyFunc func2, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, + gpointer user_data); void image_stop_load (gpointer context); gboolean image_load_increment(gpointer context, guchar *buf, guint size); @@ -686,6 +689,8 @@ image_load (FILE *f) gpointer image_begin_load (ModulePreparedNotifyFunc prepared_func, ModuleUpdatedNotifyFunc updated_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, gpointer user_data) { PnmLoaderContext *context; @@ -836,11 +841,11 @@ image_load_increment (gpointer data, guchar *buf, guint size) /* send updated signal */ (* context->updated_func) (context->pixbuf, - context->user_data, - 0, - context->output_row-1, - context->width, - 1); + 0, + context->output_row-1, + context->width, + 1, + context->user_data); } } diff --git a/gdk-pixbuf/io-ras.c b/gdk-pixbuf/io-ras.c index e0b2e4158..17a45942d 100644 --- a/gdk-pixbuf/io-ras.c +++ b/gdk-pixbuf/io-ras.c @@ -94,7 +94,10 @@ struct ras_progressive_state { gpointer image_begin_load(ModulePreparedNotifyFunc prepared_func, - ModuleUpdatedNotifyFunc updated_func, gpointer user_data); + ModuleUpdatedNotifyFunc updated_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, + gpointer user_data); void image_stop_load(gpointer data); gboolean image_load_increment(gpointer data, guchar * buf, guint size); @@ -109,7 +112,7 @@ GdkPixbuf *image_load(FILE * f) GdkPixbuf *pb; - State = image_begin_load(NULL, NULL, NULL); + State = image_begin_load(NULL, NULL, NULL, NULL, NULL); membuf = g_malloc(4096); @@ -206,7 +209,10 @@ static void RAS2State(struct rasterfile *RAS, gpointer image_begin_load(ModulePreparedNotifyFunc prepared_func, - ModuleUpdatedNotifyFunc updated_func, gpointer user_data) + ModuleUpdatedNotifyFunc updated_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, + gpointer user_data) { struct ras_progressive_state *context; @@ -364,11 +370,11 @@ static void OneLine(struct ras_progressive_state *context) if (context->updated_func != NULL) { (*context->updated_func) (context->pixbuf, - context->user_data, 0, context->Lines, context->Header.width, - context->Header.height); + context->Header.height, + context->user_data); } } diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index 208a1b724..155a03577 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -111,7 +111,7 @@ image_load_real (FILE *f, TiffData *context) if (context) { gdk_pixbuf_unref (pixbuf); - (* context->update_func) (pixbuf, context->user_data, 0, 0, w, h); + (* context->update_func) (pixbuf, 0, 0, w, h, context->user_data); } return pixbuf; @@ -139,6 +139,8 @@ image_load (FILE *f) gpointer image_begin_load (ModulePreparedNotifyFunc prepare_func, ModuleUpdatedNotifyFunc update_func, + ModuleFrameDoneNotifyFunc frame_done_func, + ModuleAnimationDoneNotifyFunc anim_done_func, gpointer user_data) { TiffData *context; diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c index 3d2243662..cd1b91418 100644 --- a/gtk/gdk-pixbuf-loader.c +++ b/gtk/gdk-pixbuf-loader.c @@ -222,7 +222,7 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader) } static void -gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, gpointer loader, guint x, guint y, guint width, guint height) +gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, guint x, guint y, guint width, guint height, gpointer loader) { GdkPixbufLoaderPrivate *priv = NULL; @@ -276,7 +276,7 @@ gdk_pixbuf_loader_load_module(GdkPixbufLoader *loader) return 0; } - priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, gdk_pixbuf_loader_update, loader); + priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, gdk_pixbuf_loader_update, NULL, NULL, loader); if (priv->context == NULL) { g_warning("Failed to begin progressive load"); |