[gimp] app: change GimpBuffer to keep around an actual GimpColorProfile



commit e8a5f285a70efdee5f020d07608c5f921ff835e3
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 16 13:14:56 2015 +0200

    app: change GimpBuffer to keep around an actual GimpColorProfile
    
    not an icc_data blob. This simplifies the code using GimpBuffers
    together with color profiles.

 app/actions/layers-commands.c     |    2 +-
 app/core/gimp-edit.c              |   10 +---
 app/core/gimp-utils.c             |    2 +-
 app/core/gimpbuffer.c             |   61 ++++++++++------------
 app/core/gimpbuffer.h             |   47 ++++++++---------
 app/core/gimpdrawable-transform.c |    2 +-
 app/core/gimpimage-new.c          |   17 +++---
 app/core/gimplayer-new.c          |  100 ++++++++++++++-----------------------
 app/core/gimplayer-new.h          |    3 +-
 app/core/gimpselection.c          |    2 +-
 app/pdb/layer-cmds.c              |   14 +++--
 tools/pdbgen/pdb/layer.pdb        |   15 +++--
 12 files changed, 120 insertions(+), 155 deletions(-)
---
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 8ce3165..00df25a 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -364,7 +364,7 @@ layers_new_from_visible_cmd_callback (GtkAction *action,
                                            _("Visible"),
                                            GIMP_OPACITY_OPAQUE,
                                            GIMP_NORMAL_MODE,
-                                           NULL, 0 /* same image */);
+                                           NULL /* same image */);
 
   gimp_image_add_layer (image, layer,
                         GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index e08ffe3..c8704c8 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -612,16 +612,10 @@ gimp_edit_extract (GimpImage     *image,
       if (GIMP_IS_LAYER (pickable) ||
           GIMP_IS_IMAGE (pickable))
         {
-          GimpColorProfile *profile;
-          const guint8     *icc_data;
-          gsize             icc_len;
-
-          profile =
+          GimpColorProfile *profile =
             gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
 
-          icc_data = gimp_color_profile_get_icc_profile (profile, &icc_len);
-          gimp_buffer_set_icc_profile (gimp_buffer, icc_data, icc_len);
-
+          gimp_buffer_set_color_profile (gimp_buffer, profile);
           g_object_unref (profile);
         }
 
diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c
index 1be3109..5e448f8 100644
--- a/app/core/gimp-utils.c
+++ b/app/core/gimp-utils.c
@@ -781,7 +781,7 @@ gimp_create_image_from_buffer (Gimp        *gimp,
                                            image_name,
                                            GIMP_OPACITY_OPAQUE,
                                            GIMP_NORMAL_MODE,
-                                           NULL, 0 /* same image */);
+                                           NULL /* same image */);
   gimp_image_add_layer (image, layer, NULL, -1, FALSE);
 
   gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL, 0);
diff --git a/app/core/gimpbuffer.c b/app/core/gimpbuffer.c
index cbe61b3..d787fa1 100644
--- a/app/core/gimpbuffer.c
+++ b/app/core/gimpbuffer.c
@@ -101,7 +101,7 @@ gimp_buffer_finalize (GObject *object)
       buffer->buffer = NULL;
     }
 
-  gimp_buffer_set_icc_profile (buffer, NULL, 0);
+  gimp_buffer_set_color_profile (buffer, NULL);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -114,7 +114,7 @@ gimp_buffer_get_memsize (GimpObject *object,
   gint64      memsize = 0;
 
   memsize += gimp_gegl_buffer_get_memsize (buffer->buffer);
-  memsize += buffer->icc_profile_len;
+  memsize += gimp_g_object_get_memsize (G_OBJECT (buffer->color_profile));
 
   return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
                                                                   gui_size);
@@ -269,10 +269,11 @@ gimp_buffer_new_from_pixbuf (GdkPixbuf   *pixbuf,
                              gint         offset_x,
                              gint         offset_y)
 {
-  GimpBuffer *gimp_buffer;
-  GeglBuffer *buffer;
-  guint8     *icc_data;
-  gsize       icc_len;
+  GimpBuffer       *gimp_buffer;
+  GeglBuffer       *buffer;
+  guint8           *icc_data;
+  gsize             icc_len;
+  GimpColorProfile *profile = NULL;
 
   g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
   g_return_val_if_fail (name != NULL, NULL);
@@ -283,20 +284,21 @@ gimp_buffer_new_from_pixbuf (GdkPixbuf   *pixbuf,
                                  offset_x, offset_y, FALSE);
 
   icc_data = gimp_pixbuf_get_icc_profile (pixbuf, &icc_len);
-
   if (icc_data)
     {
-      gimp_buffer_set_icc_profile (gimp_buffer, icc_data, icc_len);
+      profile = gimp_color_profile_new_from_icc_profile (icc_data, icc_len,
+                                                         NULL);
       g_free (icc_data);
     }
-  else if (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB)
-    {
-      GimpColorProfile *profile = gimp_color_profile_new_srgb ();
-      const guint8     *icc_data;
 
-      icc_data = gimp_color_profile_get_icc_profile (profile, &icc_len);
-      gimp_buffer_set_icc_profile (gimp_buffer, icc_data, icc_len);
+  if (! profile && gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB)
+    {
+      profile = gimp_color_profile_new_srgb ();
+    }
 
+  if (profile)
+    {
+      gimp_buffer_set_color_profile (gimp_buffer, profile);
       g_object_unref (profile);
     }
 
@@ -338,38 +340,31 @@ gimp_buffer_get_buffer (const GimpBuffer *buffer)
 }
 
 void
-gimp_buffer_set_icc_profile (GimpBuffer   *buffer,
-                             const guint8 *data,
-                             gsize         length)
+gimp_buffer_set_color_profile (GimpBuffer       *buffer,
+                               GimpColorProfile *profile)
 {
   g_return_if_fail (GIMP_IS_BUFFER (buffer));
-  g_return_if_fail (data == NULL || length != 0);
+  g_return_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile));
 
-  if (data != buffer->icc_profile)
+  if (profile != buffer->color_profile)
     {
-      if (buffer->icc_profile)
+      if (buffer->color_profile)
         {
-          g_free (buffer->icc_profile);
-          buffer->icc_profile     = NULL;
-          buffer->icc_profile_len = 0;
+          g_object_unref (buffer->color_profile);
+          buffer->color_profile = NULL;
         }
 
-      if (data)
+      if (profile)
         {
-          buffer->icc_profile     = g_memdup (data, length);
-          buffer->icc_profile_len = length;
+          buffer->color_profile = g_object_ref (profile);
         }
     }
 }
 
-const guint8 *
-gimp_buffer_get_icc_profile (const GimpBuffer *buffer,
-                             gsize            *length)
+GimpColorProfile *
+gimp_buffer_get_color_profile (const GimpBuffer *buffer)
 {
   g_return_val_if_fail (GIMP_IS_BUFFER (buffer), NULL);
 
-  if (length)
-    *length = buffer->icc_profile_len;
-
-  return buffer->icc_profile;
+  return buffer->color_profile;
 }
diff --git a/app/core/gimpbuffer.h b/app/core/gimpbuffer.h
index cc93eac..6817ed6 100644
--- a/app/core/gimpbuffer.h
+++ b/app/core/gimpbuffer.h
@@ -34,14 +34,13 @@ typedef struct _GimpBufferClass GimpBufferClass;
 
 struct _GimpBuffer
 {
-  GimpViewable   parent_instance;
+  GimpViewable      parent_instance;
 
-  GeglBuffer    *buffer;
-  gint           offset_x;
-  gint           offset_y;
+  GeglBuffer       *buffer;
+  gint              offset_x;
+  gint              offset_y;
 
-  guint8        *icc_profile;
-  gsize          icc_profile_len;
+  GimpColorProfile *color_profile;
 };
 
 struct _GimpBufferClass
@@ -50,29 +49,27 @@ struct _GimpBufferClass
 };
 
 
-GType           gimp_buffer_get_type        (void) G_GNUC_CONST;
+GType              gimp_buffer_get_type          (void) G_GNUC_CONST;
 
-GimpBuffer    * gimp_buffer_new             (GeglBuffer       *buffer,
-                                             const gchar      *name,
-                                             gint              offset_x,
-                                             gint              offset_y,
-                                             gboolean          copy_pixels);
-GimpBuffer    * gimp_buffer_new_from_pixbuf (GdkPixbuf        *pixbuf,
-                                             const gchar      *name,
-                                             gint              offset_x,
-                                             gint              offset_y);
+GimpBuffer       * gimp_buffer_new               (GeglBuffer       *buffer,
+                                                  const gchar      *name,
+                                                  gint              offset_x,
+                                                  gint              offset_y,
+                                                  gboolean          copy_pixels);
+GimpBuffer       * gimp_buffer_new_from_pixbuf   (GdkPixbuf        *pixbuf,
+                                                  const gchar      *name,
+                                                  gint              offset_x,
+                                                  gint              offset_y);
 
-gint            gimp_buffer_get_width       (const GimpBuffer *buffer);
-gint            gimp_buffer_get_height      (const GimpBuffer *buffer);
-const Babl    * gimp_buffer_get_format      (const GimpBuffer *buffer);
+gint               gimp_buffer_get_width         (const GimpBuffer *buffer);
+gint               gimp_buffer_get_height        (const GimpBuffer *buffer);
+const Babl       * gimp_buffer_get_format        (const GimpBuffer *buffer);
 
-GeglBuffer    * gimp_buffer_get_buffer      (const GimpBuffer *buffer);
+GeglBuffer       * gimp_buffer_get_buffer        (const GimpBuffer *buffer);
 
-void            gimp_buffer_set_icc_profile (GimpBuffer       *buffer,
-                                             const guint8     *data,
-                                             gsize             length);
-const guint8  * gimp_buffer_get_icc_profile (const GimpBuffer *buffer,
-                                             gsize            *length);
+void               gimp_buffer_set_color_profile (GimpBuffer       *buffer,
+                                                  GimpColorProfile *profile);
+GimpColorProfile * gimp_buffer_get_color_profile (const GimpBuffer *buffer);
 
 
 #endif /* __GIMP_BUFFER_H__ */
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index e2c9c60..f1dfa6b 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -963,7 +963,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
                                          gimp_drawable_get_format_with_alpha (drawable),
                                          _("Transformation"),
                                          GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
-                                         NULL, 0 /* same image */);
+                                         NULL /* same image */);
 
       gimp_item_set_offset (GIMP_ITEM (layer), offset_x, offset_y);
 
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 8c90149..9fd97c3 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -279,12 +279,11 @@ gimp_image_new_from_buffer (Gimp       *gimp,
                             GimpImage  *invoke,
                             GimpBuffer *paste)
 {
-  GimpImage    *image;
-  GimpLayer    *layer;
-  const Babl   *format;
-  gboolean      has_alpha;
-  const guint8 *icc_data;
-  gsize         icc_len;
+  GimpImage        *image;
+  GimpLayer        *layer;
+  const Babl       *format;
+  gboolean          has_alpha;
+  GimpColorProfile *profile;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
   g_return_val_if_fail (invoke == NULL || GIMP_IS_IMAGE (invoke), NULL);
@@ -312,9 +311,9 @@ gimp_image_new_from_buffer (Gimp       *gimp,
       gimp_image_set_unit (image, gimp_image_get_unit (invoke));
     }
 
-  icc_data = gimp_buffer_get_icc_profile (paste, &icc_len);
-  if (icc_data)
-    gimp_image_set_icc_profile (image, icc_data, icc_len, NULL);
+  profile = gimp_buffer_get_color_profile (paste);
+  if (profile)
+    gimp_image_set_color_profile (image, profile, NULL);
 
   layer = gimp_layer_new_from_buffer (paste, image,
                                       gimp_image_get_layer_format (image,
diff --git a/app/core/gimplayer-new.c b/app/core/gimplayer-new.c
index e9d6057..db62626 100644
--- a/app/core/gimplayer-new.c
+++ b/app/core/gimplayer-new.c
@@ -40,11 +40,10 @@
 
 /*  local function prototypes  */
 
-static gboolean   gimp_layer_new_convert_profile (GimpLayer     *layer,
-                                                  GeglBuffer    *src_buffer,
-                                                  const guint8  *icc_data,
-                                                  gsize          icc_length,
-                                                  GError       **error);
+static void   gimp_layer_new_convert_buffer (GimpLayer         *layer,
+                                             GeglBuffer        *src_buffer,
+                                             GimpColorProfile  *src_profile,
+                                             GError           **error);
 
 
 /*  public functions  */
@@ -101,19 +100,14 @@ gimp_layer_new_from_buffer (GimpBuffer           *buffer,
                             gdouble               opacity,
                             GimpLayerModeEffects  mode)
 {
-  const guint8 *icc_data;
-  gsize         icc_len;
-
   g_return_val_if_fail (GIMP_IS_BUFFER (buffer), NULL);
   g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
   g_return_val_if_fail (format != NULL, NULL);
 
-  icc_data = gimp_buffer_get_icc_profile (buffer, &icc_len);
-
   return gimp_layer_new_from_gegl_buffer (gimp_buffer_get_buffer (buffer),
                                           dest_image, format,
                                           name, opacity, mode,
-                                          icc_data, icc_len);
+                                          gimp_buffer_get_color_profile (buffer));
 }
 
 /**
@@ -138,15 +132,15 @@ gimp_layer_new_from_gegl_buffer (GeglBuffer           *buffer,
                                  const gchar          *name,
                                  gdouble               opacity,
                                  GimpLayerModeEffects  mode,
-                                 const guint8         *buffer_icc_data,
-                                 gsize                 buffer_icc_length)
+                                 GimpColorProfile     *buffer_profile)
 {
   GimpLayer *layer;
 
   g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
   g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
   g_return_val_if_fail (format != NULL, NULL);
-  g_return_val_if_fail (buffer_icc_data != NULL || buffer_icc_length == 0, NULL);
+  g_return_val_if_fail (buffer_profile == NULL ||
+                        GIMP_IS_COLOR_PROFILE (buffer_profile), NULL);
 
   /*  do *not* use the buffer's format because this function gets
    *  buffers of any format passed, and converts them
@@ -157,17 +151,7 @@ gimp_layer_new_from_gegl_buffer (GeglBuffer           *buffer,
                           format,
                           name, opacity, mode);
 
-  if (buffer_icc_data)
-    {
-      gimp_layer_new_convert_profile (layer, buffer,
-                                      buffer_icc_data, buffer_icc_length,
-                                      NULL);
-    }
-  else
-    {
-      gegl_buffer_copy (buffer, NULL, GEGL_ABYSS_NONE,
-                        gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)), NULL);
-    }
+  gimp_layer_new_convert_buffer (layer, buffer, buffer_profile, NULL);
 
   return layer;
 }
@@ -195,10 +179,11 @@ gimp_layer_new_from_pixbuf (GdkPixbuf            *pixbuf,
                             gdouble               opacity,
                             GimpLayerModeEffects  mode)
 {
-  GimpLayer  *layer;
-  GeglBuffer *buffer;
-  guint8     *icc_data;
-  gsize       icc_len;
+  GimpLayer        *layer;
+  GeglBuffer       *buffer;
+  guint8           *icc_data;
+  gsize             icc_len;
+  GimpColorProfile *profile = NULL;
 
   g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
   g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
@@ -212,28 +197,23 @@ gimp_layer_new_from_pixbuf (GdkPixbuf            *pixbuf,
   buffer = gimp_pixbuf_create_buffer (pixbuf);
 
   icc_data = gimp_pixbuf_get_icc_profile (pixbuf, &icc_len);
-
   if (icc_data)
     {
-      gimp_layer_new_convert_profile (layer, buffer, icc_data, icc_len, NULL);
+      profile = gimp_color_profile_new_from_icc_profile (icc_data, icc_len,
+                                                         NULL);
       g_free (icc_data);
     }
-  else if (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB)
-    {
-      GimpColorProfile *profile = gimp_color_profile_new_srgb ();
-      const guint8     *icc_data;
-
-      icc_data = gimp_color_profile_get_icc_profile (profile, &icc_len);
-      gimp_layer_new_convert_profile (layer, buffer, icc_data, icc_len, NULL);
 
-      g_object_unref (profile);
-    }
-  else
+  if (! profile && gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB)
     {
-      gegl_buffer_copy (buffer, NULL, GEGL_ABYSS_NONE,
-                        gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)), NULL);
+      profile = gimp_color_profile_new_srgb ();
     }
 
+  gimp_layer_new_convert_buffer (layer, buffer, profile, NULL);
+
+  if (profile)
+    g_object_unref (profile);
+
   g_object_unref (buffer);
 
   return layer;
@@ -242,46 +222,40 @@ gimp_layer_new_from_pixbuf (GdkPixbuf            *pixbuf,
 
 /*  private functions  */
 
-static gboolean
-gimp_layer_new_convert_profile (GimpLayer     *layer,
-                                GeglBuffer    *src_buffer,
-                                const guint8  *icc_data,
-                                gsize          icc_length,
-                                GError       **error)
+static void
+gimp_layer_new_convert_buffer (GimpLayer         *layer,
+                               GeglBuffer        *src_buffer,
+                               GimpColorProfile  *src_profile,
+                               GError           **error)
 {
   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 *src_profile;
   GimpColorProfile *dest_profile;
 
-  /*  FIXME: this is the wrong check, need something like file import
-   *  conversion config
-   */
-  if (config->mode == GIMP_COLOR_MANAGEMENT_OFF)
+  if (! src_profile)
     {
       gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE, dest_buffer, NULL);
-      return TRUE;
+      return;
     }
 
-  src_profile = gimp_color_profile_new_from_icc_profile (icc_data, icc_length,
-                                                         error);
-  if (! src_profile)
+  /*  FIXME: this is the wrong check, need something like file import
+   *  conversion config
+   */
+  if (config->mode == GIMP_COLOR_MANAGEMENT_OFF)
     {
       gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE, dest_buffer, NULL);
-      return FALSE;
+      return;
     }
 
-  dest_profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
+  dest_profile =
+    gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
 
   gimp_gegl_convert_color_profile (src_buffer,  NULL, src_profile,
                                    dest_buffer, NULL, dest_profile,
                                    GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
                                    FALSE);
 
-  g_object_unref (src_profile);
   g_object_unref (dest_profile);
-
-  return TRUE;
 }
diff --git a/app/core/gimplayer-new.h b/app/core/gimplayer-new.h
index d369c88..3432904 100644
--- a/app/core/gimplayer-new.h
+++ b/app/core/gimplayer-new.h
@@ -39,8 +39,7 @@ GimpLayer * gimp_layer_new_from_gegl_buffer (GeglBuffer           *buffer,
                                              const gchar          *name,
                                              gdouble               opacity,
                                              GimpLayerModeEffects  mode,
-                                             const guint8         *buffer_icc_data,
-                                             gsize                 buffer_icc_length);
+                                             GimpColorProfile     *buffer_profile);
 GimpLayer * gimp_layer_new_from_pixbuf      (GdkPixbuf            *pixbuf,
                                              GimpImage            *dest_image,
                                              const Babl           *format,
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index dc1fcf7..a0b4c0f 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -836,7 +836,7 @@ gimp_selection_float (GimpSelection *selection,
                                            _("Floated Layer"),
                                            GIMP_OPACITY_OPAQUE,
                                            GIMP_NORMAL_MODE,
-                                           NULL, 0 /* same image */);
+                                           NULL /* same image */);
 
   /*  Set the offsets  */
   gimp_item_set_offset (GIMP_ITEM (layer), x1 + off_x, y1 + off_y);
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index 3e151d4..f28ff83 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -19,11 +19,14 @@
 
 #include "config.h"
 
+#include <cairo.h>
+
 #include <gegl.h>
 
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 #include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
 
 #include "libgimpbase/gimpbase.h"
 
@@ -165,13 +168,12 @@ layer_new_from_visible_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      GimpPickable *pickable = GIMP_PICKABLE (image);
-      const guint8 *icc_data;
-      gsize         icc_len;
+      GimpPickable     *pickable = GIMP_PICKABLE (image);
+      GimpColorProfile *profile;
 
       gimp_pickable_flush (pickable);
 
-      icc_data = gimp_image_get_icc_profile (image, &icc_len);
+      profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
 
       layer = gimp_layer_new_from_gegl_buffer (gimp_pickable_get_buffer (pickable),
                                                dest_image,
@@ -180,7 +182,9 @@ layer_new_from_visible_invoker (GimpProcedure         *procedure,
                                                name,
                                                GIMP_OPACITY_OPAQUE,
                                                GIMP_NORMAL_MODE,
-                                               icc_data, icc_len);
+                                               profile);
+
+      g_object_unref (profile);
     }
 
   return_vals = gimp_procedure_get_return_values (procedure, success,
diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb
index 926cb29..550f917 100644
--- a/tools/pdbgen/pdb/layer.pdb
+++ b/tools/pdbgen/pdb/layer.pdb
@@ -142,13 +142,12 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpPickable *pickable = GIMP_PICKABLE (image);
-  const guint8 *icc_data;
-  gsize         icc_len;
+  GimpPickable     *pickable = GIMP_PICKABLE (image);
+  GimpColorProfile *profile;
 
   gimp_pickable_flush (pickable);
 
-  icc_data = gimp_image_get_icc_profile (image, &icc_len);
+  profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
 
   layer = gimp_layer_new_from_gegl_buffer (gimp_pickable_get_buffer (pickable),
                                            dest_image,
@@ -157,7 +156,9 @@ HELP
                                            name,
                                            GIMP_OPACITY_OPAQUE,
                                            GIMP_NORMAL_MODE,
-                                           icc_data, icc_len);
+                                           profile);
+
+  g_object_unref (profile);
 }
 CODE
     );
@@ -1195,7 +1196,9 @@ CODE
     );
 }
 
- headers = qw("libgimpbase/gimpbase.h"
+ headers = qw(<cairo.h>
+              "libgimpbase/gimpbase.h"
+              "libgimpcolor/gimpcolor.h"
               "core/gimp.h"
               "core/gimpimage-color-profile.h"
               "core/gimpimage-undo.h"


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