[gtk/gamma-shenanigans: 8/8] Load jpegs without gdk-pixbuf




commit c59495f585b9e02b411e78313e04e0b4aa4faf58
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 10 00:01:22 2021 -0400

    Load jpegs without gdk-pixbuf
    
    Use our own loader for jpeg files.

 gdk/gdktexture.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index 9ea57a0d24..e73388850e 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -48,6 +48,7 @@
 #include <graphene.h>
 #include "gdkpng.h"
 #include "gdktiff.h"
+#include "gdkjpeg.h"
 
 /* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
 void
@@ -409,6 +410,13 @@ gdk_texture_new_from_file (GFile   *file,
       return texture;
     }
 
+  if (memcmp (data, "\xff\xd8", 2) == 0)
+    {
+      texture = gdk_load_jpeg (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]