[gimp] app: same fix as below in gimplayer-new.c



commit 5ec6d2c0f79b1ceeef32edbe468c45b9462f4fac
Author: Michael Natterer <mitch gimp org>
Date:   Sun May 8 18:30:17 2016 +0200

    app: same fix as below in gimplayer-new.c
    
    Don't use the (wrong) global display color managment switch to
    determine whether or not to convert the buffer to the image's
    profile. Use the image's "is color managed" switch.

 app/core/gimplayer-new.c |   30 +++++++++++-------------------
 1 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/app/core/gimplayer-new.c b/app/core/gimplayer-new.c
index 4148c8b..1b3c94d 100644
--- a/app/core/gimplayer-new.c
+++ b/app/core/gimplayer-new.c
@@ -26,12 +26,9 @@
 
 #include "core-types.h"
 
-#include "config/gimpcoreconfig.h"
-
 #include "gegl/gimp-babl.h"
 #include "gegl/gimp-gegl-loops.h"
 
-#include "gimp.h"
 #include "gimpbuffer.h"
 #include "gimpimage.h"
 #include "gimplayer.h"
@@ -204,11 +201,6 @@ gimp_layer_new_from_pixbuf (GdkPixbuf            *pixbuf,
       g_free (icc_data);
     }
 
-  if (! profile && gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB)
-    {
-      profile = gimp_color_profile_new_rgb_srgb ();
-    }
-
   gimp_layer_new_convert_buffer (layer, buffer, profile, NULL);
 
   if (profile)
@@ -230,25 +222,25 @@ gimp_layer_new_convert_buffer (GimpLayer         *layer,
 {
   GimpDrawable     *drawable    = GIMP_DRAWABLE (layer);
   GimpImage        *image       = gimp_item_get_image (GIMP_ITEM (layer));
-  GimpColorConfig  *config      = image->gimp->config->color_management;
   GeglBuffer       *dest_buffer = gimp_drawable_get_buffer (drawable);
   GimpColorProfile *dest_profile;
 
-  dest_profile =
-    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (layer));
-
-  if (! src_profile  ||
-      ! dest_profile ||
-
-      /*  FIXME: this is the wrong check, need something like file import
-       *  conversion config
-       */
-      config->mode == GIMP_COLOR_MANAGEMENT_OFF)
+  if (! gimp_image_get_is_color_managed (image))
     {
       gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE, dest_buffer, NULL);
       return;
     }
 
+  if (! src_profile)
+    {
+      const Babl *src_format = gegl_buffer_get_format (src_buffer);
+
+      src_profile = gimp_babl_format_get_color_profile (src_format);
+    }
+
+  dest_profile =
+    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (layer));
+
   gimp_gegl_convert_color_profile (src_buffer,  NULL, src_profile,
                                    dest_buffer, NULL, dest_profile,
                                    GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,


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