summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-tiff.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-01-07 00:26:58 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-01-07 00:26:58 +0000
commit5b26e695a1fc70c99b58f2e9c4c922412fbd1a08 (patch)
tree2f5f563c13bfc6d7427311b48bfbb36dd60e78a9 /gdk-pixbuf/io-tiff.c
parent72b7abd535ba6aeb0c5911b6e6a19ec26f90ecf7 (diff)
downloadgdk-pixbuf-5b26e695a1fc70c99b58f2e9c4c922412fbd1a08.tar.gz
Make it possible to call gdk_pixbuf_loader_set_size (loader, 0, 0) by
Wed Jan 7 01:17:36 2004 Matthias Clasen <maclas@gmx.de> * gdk-pixbuf-loader.c (gdk_pixbuf_loader_size_func): * gdk-pixbuf-loader.c (gdk_pixbuf_loader_set_size): * gdk-pixbuf-loader.c (gdk_pixbuf_loader_init): Make it possible to call gdk_pixbuf_loader_set_size (loader, 0, 0) by changing the initial values of priv->width/height to -1. * io-tiff.c (tiff_image_parse): * io-ras.c (RAS2State): * io-pnm.c (gdk_pixbuf__pnm_image_load_increment): * io-pcx.c (gdk_pixbuf__pcx_load_increment): * io-jpeg.c (gdk_pixbuf__jpeg_image_load_increment): * io-png.c (png_info_callback): * io-ico.c (DecodeHeader): * io-bmp.c (DecodeHeader): Call size_func once the size is known, even if the module can't make use of the scaling information. If size_func returns 0, don't allocate a pixbuf and return, if necessary with an error. * gdk-pixbuf.h: * gdk-pixbuf-io.c (gdk_pixbuf_get_file_info): A new function to determine the type and size of an image file without loading it completely. (#53725)
Diffstat (limited to 'gdk-pixbuf/io-tiff.c')
-rw-r--r--gdk-pixbuf/io-tiff.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c
index 3e6d9fca0..2d47f6594 100644
--- a/gdk-pixbuf/io-tiff.c
+++ b/gdk-pixbuf/io-tiff.c
@@ -47,6 +47,7 @@
typedef struct _TiffContext TiffContext;
struct _TiffContext
{
+ GdkPixbufModuleSizeFunc size_func;
GdkPixbufModulePreparedFunc prepare_func;
GdkPixbufModuleUpdatedFunc update_func;
gpointer user_data;
@@ -225,6 +226,15 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
return NULL;
}
+ if (context && context->size_func) {
+ gint w = width;
+ gint h = height;
+ (* context->size_func) (&w, &h, context->user_data);
+
+ if (w == 0 || h == 0)
+ return NULL;
+ }
+
pixels = g_try_malloc (bytes);
if (!pixels) {
@@ -370,6 +380,7 @@ gdk_pixbuf__tiff_image_begin_load (GdkPixbufModuleSizeFunc size_func,
TiffContext *context;
context = g_new0 (TiffContext, 1);
+ context->size_func = size_func;
context->prepare_func = prepare_func;
context->update_func = update_func;
context->user_data = user_data;