[gdk-pixbuf] jasper: Add debug output for unhandled images



commit d537cacad65216f29455021a16c275a81174184a
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 28 18:35:57 2016 +0100

    jasper: Add debug output for unhandled images
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685543

 gdk-pixbuf/io-jasper.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/io-jasper.c b/gdk-pixbuf/io-jasper.c
index effffab..d205138 100644
--- a/gdk-pixbuf/io-jasper.c
+++ b/gdk-pixbuf/io-jasper.c
@@ -89,6 +89,27 @@ jasper_image_begin_load (GdkPixbufModuleSizeFunc size_func,
        return context;
 }
 
+static const char *
+colourspace_to_str (int c)
+{
+       switch (c) {
+       case JAS_CLRSPC_FAM_UNKNOWN:
+               return "Unknown";
+       case JAS_CLRSPC_FAM_XYZ:
+               return "XYZ";
+       case JAS_CLRSPC_FAM_LAB:
+               return "LAB";
+       case JAS_CLRSPC_FAM_GRAY:
+               return "GRAY";
+       case JAS_CLRSPC_FAM_RGB:
+               return "RGB";
+       case JAS_CLRSPC_FAM_YCBCR:
+               return "YCbCr";
+       default:
+               return "Invalid";
+       }
+}
+
 static gboolean
 jasper_image_try_load (struct jasper_context *context, GError **error)
 {
@@ -130,7 +151,9 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
 
        if ((num_components != 3 && num_components != 4 && num_components != 1) ||
            (colourspace_family != JAS_CLRSPC_FAM_RGB  && colourspace_family != JAS_CLRSPC_FAM_GRAY)) {
-               jas_image_destroy (raw_image);
+               jas_image_destroy (raw_image);
+               g_debug ("Unsupported colourspace %s (num components: %d)",
+                        colourspace_to_str (colourspace_family), num_components);
                g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
                                      _("Image type currently not supported"));
                return FALSE;


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