[gtk/image-loading: 14/15] Load jpegs without gdk-pixbuf




commit e9e2f4805d2197e30af27333bf2f1d5bdc26afa5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 11 17:02:41 2021 -0400

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

 gdk/gdktexture.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index 06987ff9e6..6adfd39e13 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -48,6 +48,7 @@
 #include <graphene.h>
 #include "loaders/gdkpngprivate.h"
 #include "loaders/gdktiffprivate.h"
+#include "loaders/gdkjpegprivate.h"
 
 /* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
 void
@@ -443,6 +444,11 @@ gdk_texture_new_from_bytes (GBytes  *bytes,
     {
       return gdk_load_tiff (bytes, error);
     }
+  else if (size > strlen (JPEG_SIGNATURE) &&
+           memcmp (data, JPEG_SIGNATURE, strlen (JPEG_SIGNATURE)) == 0)
+    {
+      return gdk_load_jpeg (bytes, error);
+    }
   else
     {
       GInputStream *stream;


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