[gimp] app: pass the right color profile around in gimp_selection_float()



commit 2739c3457347c5aca3110bf85d6aaa05d5ad08ca
Author: Michael Natterer <mitch gimp org>
Date:   Sun May 8 18:33:22 2016 +0200

    app: pass the right color profile around in gimp_selection_float()
    
    This doesn make any difference because a NULL profile would do the
    same, but it's safer to pass the actual profile instead of relying on
    the magic meaning of NULL in the call to
    gimp_layer_new_from_gegl_buffer().

 app/core/gimpselection.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index 0ab9763..6b412e9 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -17,11 +17,12 @@
 
 #include "config.h"
 
-#include <string.h>
-
+#include <cairo.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gegl.h>
 
+#include "libgimpcolor/gimpcolor.h"
+
 #include "core-types.h"
 
 #include "gegl/gimp-babl.h"
@@ -851,11 +852,12 @@ gimp_selection_float (GimpSelection *selection,
                       gint           off_y,
                       GError       **error)
 {
-  GimpImage  *image;
-  GimpLayer  *layer;
-  GeglBuffer *buffer;
-  gint        x1, y1;
-  gint        x2, y2;
+  GimpImage        *image;
+  GimpLayer        *layer;
+  GeglBuffer       *buffer;
+  GimpColorProfile *profile;
+  gint              x1, y1;
+  gint              x2, y2;
 
   g_return_val_if_fail (GIMP_IS_SELECTION (selection), NULL);
   g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@@ -884,6 +886,8 @@ gimp_selection_float (GimpSelection *selection,
                                    cut_image, FALSE, TRUE,
                                    &x1, &y1, NULL);
 
+  profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
+
   /*  Clear the selection  */
   gimp_channel_clear (GIMP_CHANNEL (selection), NULL, TRUE);
 
@@ -896,7 +900,7 @@ gimp_selection_float (GimpSelection *selection,
                                            _("Floated Layer"),
                                            GIMP_OPACITY_OPAQUE,
                                            GIMP_NORMAL_MODE,
-                                           NULL /* same image */);
+                                           profile);
 
   /*  Set the offsets  */
   gimp_item_set_offset (GIMP_ITEM (layer), x1 + off_x, y1 + off_y);


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