[gtk/image-loading: 7/15] Load tiffs without gdk-pixbuf




commit b8ee9873f3a1bde35b1a5744956b6f8e3090c5da
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 | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index 5acab3c3c7..0c9fdf5535 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -47,6 +47,7 @@
 
 #include <graphene.h>
 #include "loaders/gdkpngprivate.h"
+#include "loaders/gdktiffprivate.h"
 
 /* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
 void
@@ -435,6 +436,13 @@ gdk_texture_new_from_bytes (GBytes  *bytes,
     {
       return gdk_load_png (bytes, error);
     }
+  else if ((size > strlen (TIFF_SIGNATURE1) &&
+            memcmp (data, TIFF_SIGNATURE1, strlen (TIFF_SIGNATURE1)) == 0) ||
+           (size > strlen (TIFF_SIGNATURE2) &&
+            memcmp (data, TIFF_SIGNATURE2, strlen (TIFF_SIGNATURE2)) == 0))
+    {
+      return gdk_load_tiff (bytes, error);
+    }
   else
     {
       GInputStream *stream;


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