summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk-pixbuf/ChangeLog8
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.h3
-rw-r--r--gdk-pixbuf/gdk-pixbuf-loader.c17
-rw-r--r--gdk-pixbuf/gdk-pixbuf-loader.h2
-rw-r--r--gdk-pixbuf/io-gif.c18
-rw-r--r--gdk-pixbuf/io-png.c6
-rw-r--r--gdk-pixbuf/io-tiff.c16
-rw-r--r--gtk/gdk-pixbuf-loader.c17
-rw-r--r--gtk/gdk-pixbuf-loader.h2
9 files changed, 70 insertions, 19 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index e1d0c5581..c9f5c5da6 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,11 @@
+1999-11-04 Jonathan Blandford <jrb@redhat.com>
+
+ * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_update): handle the
+ actual update.
+ * src/io-png.c (image_begin_load): add a update_func callback.
+ * src/io-gif.c (image_begin_load): add a update_func callback.
+ * src/io-tiff.c (image_begin_load): add a update_func callback.
+
1999-11-04 Federico Mena Quintero <federico@redhat.com>
* doc/tmpl/gdk-pixbuf.sgml: Populated.
diff --git a/gdk-pixbuf/gdk-pixbuf-io.h b/gdk-pixbuf/gdk-pixbuf-io.h
index 4706106a8..ba42c95ce 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.h
+++ b/gdk-pixbuf/gdk-pixbuf-io.h
@@ -39,6 +39,7 @@ extern "C" {
typedef void (* ModulePreparedNotifyFunc) (GdkPixbuf *pixbuf, gpointer user_data);
+typedef void (* ModuleUpdatedNotifyFunc) (GdkPixbuf *pixbuf, gpointer user_data, guint x, guint y, guint width, guint height);
typedef struct _GdkPixbufModule GdkPixbufModule;
struct _GdkPixbufModule {
@@ -49,7 +50,7 @@ struct _GdkPixbufModule {
GdkPixbuf *(* load_xpm_data) (const gchar **data);
/* Incremental loading */
- gpointer (* begin_load) (ModulePreparedNotifyFunc func, gpointer user_data);
+ gpointer (* begin_load) (ModulePreparedNotifyFunc prepare_func, ModuleUpdatedNotifyFunc update_func, gpointer user_data);
void (* stop_load) (gpointer context);
gboolean (* load_increment)(gpointer context, const gchar *buf, guint size);
};
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c
index c62d325f8..eecc8a605 100644
--- a/gdk-pixbuf/gdk-pixbuf-loader.c
+++ b/gdk-pixbuf/gdk-pixbuf-loader.c
@@ -219,6 +219,21 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader)
gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]);
}
+static void
+gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, gpointer loader, guint x, guint y, guint width, guint height)
+{
+ GdkPixbufLoaderPrivate *priv = NULL;
+
+ priv = GDK_PIXBUF_LOADER (loader)->private;
+
+ gtk_signal_emit (GTK_OBJECT (loader),
+ pixbuf_loader_signals[AREA_UPDATED],
+ x, y,
+ /* sanity check in here. Defend against an errant loader */
+ MIN (width, gdk_pixbuf_get_width (priv->pixbuf)),
+ MIN (height, gdk_pixbuf_get_height (priv->pixbuf)));
+}
+
/**
@@ -259,7 +274,7 @@ gdk_pixbuf_loader_load_module(GdkPixbufLoader *loader)
return 0;
}
- priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, loader);
+ priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, gdk_pixbuf_loader_update, loader);
if (priv->context == NULL) {
g_warning("Failed to begin progressive load");
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.h b/gdk-pixbuf/gdk-pixbuf-loader.h
index 76997a117..58fab340f 100644
--- a/gdk-pixbuf/gdk-pixbuf-loader.h
+++ b/gdk-pixbuf/gdk-pixbuf-loader.h
@@ -59,7 +59,7 @@ struct _GdkPixbufLoaderClass {
void (* area_prepared) (GdkPixbufLoader *loader);
void (* area_updated) (GdkPixbufLoader *loader,
- int x, int y, int width, int height);
+ guint x, guint y, guint width, guint height);
void (* closed) (GdkPixbufLoader *loader);
};
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index e3dfdb81e..5282f03bd 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -121,7 +121,8 @@ struct _GifContext
FILE *file;
/* progressive read, only. */
- ModulePreparedNotifyFunc func;
+ ModulePreparedNotifyFunc prepare_func;
+ ModuleUpdatedNotifyFunc update_func;
gpointer user_data;
guchar *buf;
guint ptr;
@@ -650,8 +651,8 @@ gif_get_lzw (GifContext *context)
context->width,
context->height);
- if (context->func)
- (* context->func) (context->pixbuf, context->user_data);
+ if (context->prepare_func)
+ (* context->prepare_func) (context->pixbuf, context->user_data);
}
dest = gdk_pixbuf_get_pixels (context->pixbuf);
@@ -675,7 +676,7 @@ gif_get_lzw (GifContext *context)
*(temp+2) = context->color_map [2][(guchar) v];
}
- if (context->func && context->frame_interlace)
+ if (context->prepare_func && context->frame_interlace)
gif_fill_in_lines (context, dest, v);
context->draw_xpos++;
@@ -957,7 +958,8 @@ image_load (FILE *file)
context->file = file;
context->pixbuf = NULL;
context->state = GIF_START;
- context->func = NULL;
+ context->prepare_func = NULL;
+ context->update_func = NULL;
gif_main_loop (context);
@@ -965,7 +967,9 @@ image_load (FILE *file)
}
gpointer
-image_begin_load (ModulePreparedNotifyFunc func, gpointer user_data)
+image_begin_load (ModulePreparedNotifyFunc prepare_func,
+ ModuleUpdatedNotifyFunc update_func,
+ gpointer user_data)
{
GifContext *context;
@@ -973,7 +977,7 @@ image_begin_load (ModulePreparedNotifyFunc func, gpointer user_data)
count = 0;
#endif
context = g_new (GifContext, 1);
- context->func = func;
+ context->prepare_func = prepare_func;
context->user_data = user_data;
context->file = NULL;
context->pixbuf = NULL;
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
index 6dacef8f4..643b16c40 100644
--- a/gdk-pixbuf/io-png.c
+++ b/gdk-pixbuf/io-png.c
@@ -257,7 +257,9 @@ struct _LoadContext {
};
gpointer
-image_begin_load (ModulePreparedNotifyFunc func, gpointer user_data)
+image_begin_load (ModulePreparedNotifyFunc prepare_func,
+ ModuleUpdatedNotifyFunc update_func,
+ gpointer user_data)
{
LoadContext* lc;
@@ -265,7 +267,7 @@ image_begin_load (ModulePreparedNotifyFunc func, gpointer user_data)
lc->fatal_error_occurred = FALSE;
- lc->notify_func = func;
+ lc->notify_func = prepare_func;
lc->notify_user_data = user_data;
/* Create the main PNG context struct */
diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c
index d1e97126c..91272b5da 100644
--- a/gdk-pixbuf/io-tiff.c
+++ b/gdk-pixbuf/io-tiff.c
@@ -37,7 +37,8 @@
typedef struct _TiffData TiffData;
struct _TiffData
{
- ModulePreparedNotifyFunc func;
+ ModulePreparedNotifyFunc prepare_func;
+ ModuleUpdatedNotifyFunc update_func;
gpointer user_data;
gchar *tempname;
@@ -69,7 +70,7 @@ image_load_real (FILE *f, TiffData *context)
pixbuf = gdk_pixbuf_new (ART_PIX_RGB, TRUE, 8, w, h);
if (context)
- (* context->func) (pixbuf, context->user_data);
+ (* context->prepare_func) (pixbuf, context->user_data);
/* Yes, it needs to be _TIFFMalloc... */
rast = (uint32 *) _TIFFmalloc (num_pixs * sizeof (uint32));
@@ -108,8 +109,10 @@ image_load_real (FILE *f, TiffData *context)
_TIFFfree (rast);
TIFFClose (tiff);
- if (context)
+ if (context) {
gdk_pixbuf_unref (pixbuf);
+ (* context->update_func) (pixbuf, context->user_data, 0, 0, w, h);
+ }
return pixbuf;
}
@@ -132,14 +135,17 @@ image_load (FILE *f)
* the file when it's done. It's not pretty.
*/
+
gpointer
-image_begin_load (ModulePreparedNotifyFunc func, gpointer user_data)
+image_begin_load (ModulePreparedNotifyFunc prepare_func,
+ ModuleUpdatedNotifyFunc update_func,
+ gpointer user_data)
{
TiffData *context;
gint fd;
context = g_new (TiffData, 1);
- context->func = func;
+ context->prepare_func = prepare_func;
context->user_data = user_data;
context->all_okay = TRUE;
context->tempname = g_strdup ("/tmp/gdkpixbuf-tif-tmp.XXXXXX");
diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c
index c62d325f8..eecc8a605 100644
--- a/gtk/gdk-pixbuf-loader.c
+++ b/gtk/gdk-pixbuf-loader.c
@@ -219,6 +219,21 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader)
gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]);
}
+static void
+gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, gpointer loader, guint x, guint y, guint width, guint height)
+{
+ GdkPixbufLoaderPrivate *priv = NULL;
+
+ priv = GDK_PIXBUF_LOADER (loader)->private;
+
+ gtk_signal_emit (GTK_OBJECT (loader),
+ pixbuf_loader_signals[AREA_UPDATED],
+ x, y,
+ /* sanity check in here. Defend against an errant loader */
+ MIN (width, gdk_pixbuf_get_width (priv->pixbuf)),
+ MIN (height, gdk_pixbuf_get_height (priv->pixbuf)));
+}
+
/**
@@ -259,7 +274,7 @@ gdk_pixbuf_loader_load_module(GdkPixbufLoader *loader)
return 0;
}
- priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, loader);
+ priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, gdk_pixbuf_loader_update, loader);
if (priv->context == NULL) {
g_warning("Failed to begin progressive load");
diff --git a/gtk/gdk-pixbuf-loader.h b/gtk/gdk-pixbuf-loader.h
index 76997a117..58fab340f 100644
--- a/gtk/gdk-pixbuf-loader.h
+++ b/gtk/gdk-pixbuf-loader.h
@@ -59,7 +59,7 @@ struct _GdkPixbufLoaderClass {
void (* area_prepared) (GdkPixbufLoader *loader);
void (* area_updated) (GdkPixbufLoader *loader,
- int x, int y, int width, int height);
+ guint x, guint y, guint width, guint height);
void (* closed) (GdkPixbufLoader *loader);
};