[gimp] libgimp: formats with space are only for layers



commit b41d60455f1e08900fe431550246645fefdefbfa
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jan 30 11:26:01 2019 +0100

    libgimp: formats with space are only for layers
    
    gimp_drawable_get_format(): don't add the image's layer profile space
    to channel and mask formats, it's only for layers.

 libgimp/gimpdrawable.c | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c
index 57557a0b95..c3733f5dc2 100644
--- a/libgimp/gimpdrawable.c
+++ b/libgimp/gimpdrawable.c
@@ -427,28 +427,32 @@ gimp_drawable_get_format (gint32 drawable_ID)
 
   if (format_str)
     {
-      gint32            image_ID = gimp_item_get_image (drawable_ID);
-      GimpColorProfile *profile;
-      const Babl       *space = NULL;
+      gint32      image_ID = gimp_item_get_image (drawable_ID);
+      const Babl *space    = NULL;
 
-      profile = gimp_image_get_color_profile (image_ID);
-
-      if (profile)
+      if (gimp_item_is_layer (drawable_ID))
         {
-          GError *error = NULL;
+          GimpColorProfile *profile = gimp_image_get_color_profile (image_ID);
 
-          space =
-            gimp_color_profile_get_space (profile,
-                                          GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
-                                          &error);
-          if (! space)
+          if (profile)
             {
-              g_printerr ("%s: failed to create Babl space from profile: %s\n",
-                          G_STRFUNC, error->message);
-              g_clear_error (&error);
+              GError *error = NULL;
+
+              space = gimp_color_profile_get_space
+                (profile,
+                 GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
+                 &error);
+
+              if (! space)
+                {
+                  g_printerr ("%s: failed to create Babl space from "
+                              "profile: %s\n",
+                              G_STRFUNC, error->message);
+                  g_clear_error (&error);
+                }
+
+              g_object_unref (profile);
             }
-
-          g_object_unref (profile);
         }
 
       if (gimp_drawable_is_indexed (drawable_ID))


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