[gtk/image-loading: 4/9] Load tiffs without gdk-pixbuf




commit d68c68aca23a3c63201d20d011a7eda42e4cab5c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 11 16:30:37 2021 -0400

    Load tiffs without gdk-pixbuf
    
    This will let us load floating point data, in
    the future.

 gdk/gdktexture.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index 02ac1610fa..afeec5096a 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -47,6 +47,7 @@
 
 #include <graphene.h>
 #include "gdkpng.h"
+#include "gdktiff.h"
 
 /* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
 void
@@ -387,6 +388,14 @@ gdk_texture_new_from_file (GFile   *file,
       return texture;
     }
 
+  if (memcmp (data, "MM\x00\x2a", 4) == 0 ||
+      memcmp (data, "II\x2a\x00", 4) == 0)
+    {
+      texture = gdk_load_tiff (stream, error);
+      g_object_unref (stream);
+      return texture;
+    }
+
   pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, error);
   g_object_unref (stream);
   if (pixbuf == NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]