From 5a8b538ee199f1f9dbcd3b6f68e5753c0ef03170 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Thu, 28 Oct 1999 14:46:46 +0000 Subject: started work on the tiff non-incremental loader. 1999-10-28 Jonathan Blandford * src/io-tiff.c (image_load_increment): started work on the tiff non-incremental loader. * src/io-gif.c (image_load_increment): started work on the gif incremental loader. * src/gdk-pixbuf-io.h: Changed ModuleType to GdkPixbufModule. --- gdk-pixbuf/io-tiff.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'gdk-pixbuf/io-tiff.c') diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index d93dd1e509..b21dad4aec 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -25,9 +25,11 @@ /* Following code (almost) blatantly ripped from Imlib */ #include -#include +#include +#include #include #include "gdk-pixbuf.h" +#include "gdk-pixbuf-io.h" @@ -99,3 +101,60 @@ image_load (FILE *f) w, h, w * 4, free_buffer, NULL); } + +/* Progressive loader */ + +/* + * Tiff loading progressively cannot be done. We write it to a file, then load + * the file when it's done. + */ + +typedef struct _TiffData TiffData; +struct _TiffData +{ + ModulePreparedNotifyFunc *func; + gpointer user_data; + + FILE *file; +}; + +gpointer +image_begin_load (ModulePreparedNotifyFunc *func, gpointer user_data) +{ + TiffData *context; + gint fd; + char template[21]; + + context = g_new (TiffData, 1); + context->func = func; + context->user_data = user_data; + + strncpy (template, "/tmp/temp-tiffXXXXXX", strlen ("/tmp/temp-tiffXXXXXX")); + fd = mkstemp (template); + g_print ("fd=%d\n", fd); + context->file = fdopen (fd, "w"); + if (context->file == NULL) + g_print ("it's null\n"); + else + g_print ("it's not null\n"); + return context; +} + +void +image_stop_load (gpointer data) +{ + TiffData *context = (TiffData*) data; + fclose (context->file); +/* unlink (context->file);*/ + g_free ((TiffData *) context); +} + +gboolean +image_load_increment (gpointer data, guchar *buf, guint size) +{ + TiffData *context = (TiffData *) data; + + g_assert (context->file != NULL); + fwrite (buf, sizeof (guchar), size, context->file); + return TRUE; +} -- cgit v1.2.1