summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-tiff.c
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>1999-10-28 14:46:46 +0000
committerJonathan Blandford <jrb@src.gnome.org>1999-10-28 14:46:46 +0000
commit5a8b538ee199f1f9dbcd3b6f68e5753c0ef03170 (patch)
tree98fc3c19ab9c8d6d66e6abee30441ec542d4fc36 /gdk-pixbuf/io-tiff.c
parent53ffebed1953f888c0aaedbc9564f7c6a3cf8805 (diff)
downloadgtk+-5a8b538ee199f1f9dbcd3b6f68e5753c0ef03170.tar.gz
started work on the tiff non-incremental loader.
1999-10-28 Jonathan Blandford <jrb@redhat.com> * 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.
Diffstat (limited to 'gdk-pixbuf/io-tiff.c')
-rw-r--r--gdk-pixbuf/io-tiff.c61
1 files changed, 60 insertions, 1 deletions
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 <config.h>
-#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <tiffio.h>
#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;
+}