[gimp] app: don't use a NULL profile to create the new "layer from visible"



commit 95f7cab96c6042462f77214565b279a8440252e6
Author: Michael Natterer <mitch gimp org>
Date:   Wed May 4 00:00:28 2016 +0200

    app: don't use a NULL profile to create the new "layer from visible"
    
    While NULL does the right thing, better not rely on that magic parameter,
    pass the right profile and let the profile convert logic do its job.

 app/actions/layers-commands.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 465afb3..0ce9f9e 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -24,6 +24,7 @@
 
 #include "libgimpmath/gimpmath.h"
 #include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "actions-types.h"
@@ -349,15 +350,18 @@ void
 layers_new_from_visible_cmd_callback (GtkAction *action,
                                       gpointer   data)
 {
-  GimpImage    *image;
-  GimpLayer    *layer;
-  GimpPickable *pickable;
+  GimpImage        *image;
+  GimpLayer        *layer;
+  GimpPickable     *pickable;
+  GimpColorProfile *profile;
   return_if_no_image (image, data);
 
   pickable = GIMP_PICKABLE (image);
 
   gimp_pickable_flush (pickable);
 
+  profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
+
   layer = gimp_layer_new_from_gegl_buffer (gimp_pickable_get_buffer (pickable),
                                            image,
                                            gimp_image_get_layer_format (image,
@@ -365,7 +369,7 @@ layers_new_from_visible_cmd_callback (GtkAction *action,
                                            _("Visible"),
                                            GIMP_OPACITY_OPAQUE,
                                            GIMP_NORMAL_MODE,
-                                           NULL /* same image */);
+                                           profile);
 
   gimp_image_add_layer (image, layer,
                         GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);


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