[gimp] Bug 748749 - picked colors don't match image colors...



commit 8c80ee14ff71a5773a94e58372579da04bffd1aa
Author: Michael Natterer <mitch gimp org>
Date:   Tue Aug 25 00:05:59 2015 +0200

    Bug 748749 - picked colors don't match image colors...
    
    ...when a color profile is active
    
    This commit doesn't fix anything, but it prepares the code to do the
    right thing:
    
    It passes the actual raw image pixels through the entire color picking
    mechanism to the widgets which display colors, particularly
    GimpColorFrame.
    
    This is needed for GimpColorFrame's "Pixel" mode (as opposed to its
    RGB, HSV etc. modes) which is supposed to show the raw pixel values
    from the image.
    
    Before this commit, it was recreating the raw pixel values from the
    GimpRGB value it knows, which will become impossible when we correctly
    pick color managed GimpRGB values soon.

 app/core/gimpimage-pick-color.c     |    6 ++--
 app/core/gimpimage-pick-color.h     |    4 +-
 app/core/gimpmarshal.list           |    2 +-
 app/core/gimppickable.c             |   57 ++++++++++++++--------------------
 app/core/gimppickable.h             |    4 +-
 app/display/gimpcursorview.c        |    8 ++--
 app/pdb/image-cmds.c                |    4 +-
 app/tools/gimpcolorpickertool.c     |   31 ++++++++++--------
 app/tools/gimpcolortool.c           |   35 +++++++++++----------
 app/tools/gimpcolortool.h           |    8 ++--
 app/tools/gimpimagemaptool.c        |   18 +++++-----
 app/widgets/gimpcolorframe.c        |   56 ++++++++++++++++++++++------------
 app/widgets/gimpcolorframe.h        |    8 +++--
 app/widgets/gimpsamplepointeditor.c |   10 +++---
 app/widgets/gimpselectioneditor.c   |    2 +-
 tools/pdbgen/pdb/image.pdb          |    4 +-
 16 files changed, 135 insertions(+), 122 deletions(-)
---
diff --git a/app/core/gimpimage-pick-color.c b/app/core/gimpimage-pick-color.c
index 78943f1..6481445 100644
--- a/app/core/gimpimage-pick-color.c
+++ b/app/core/gimpimage-pick-color.c
@@ -37,8 +37,8 @@ gimp_image_pick_color (GimpImage     *image,
                        gboolean       sample_average,
                        gdouble        average_radius,
                        const Babl   **sample_format,
-                       GimpRGB       *color,
-                       gint          *color_index)
+                       gpointer       pixel,
+                       GimpRGB       *color)
 {
   GimpPickable *pickable;
 
@@ -82,5 +82,5 @@ gimp_image_pick_color (GimpImage     *image,
 
   return gimp_pickable_pick_color (pickable, x, y,
                                    sample_average, average_radius,
-                                   color, color_index);
+                                   pixel, color);
 }
diff --git a/app/core/gimpimage-pick-color.h b/app/core/gimpimage-pick-color.h
index 914c92f..cf82b80 100644
--- a/app/core/gimpimage-pick-color.h
+++ b/app/core/gimpimage-pick-color.h
@@ -27,8 +27,8 @@ gboolean   gimp_image_pick_color (GimpImage     *image,
                                   gboolean       sample_average,
                                   gdouble        average_radius,
                                   const Babl   **sample_format,
-                                  GimpRGB       *color,
-                                  gint          *color_index);
+                                  gpointer       pixel,
+                                  GimpRGB       *color);
 
 
 #endif  /* __GIMP_IMAGE_PICK_COLOR_H__ */
diff --git a/app/core/gimpmarshal.list b/app/core/gimpmarshal.list
index 12a1851..a8846d9 100644
--- a/app/core/gimpmarshal.list
+++ b/app/core/gimpmarshal.list
@@ -38,7 +38,7 @@ VOID: DOUBLE
 VOID: DOUBLE, DOUBLE
 VOID: DOUBLE, DOUBLE, DOUBLE, DOUBLE
 VOID: ENUM
-VOID: ENUM, DOUBLE, DOUBLE, POINTER, BOXED, INT
+VOID: ENUM, DOUBLE, DOUBLE, POINTER, POINTER, BOXED
 VOID: ENUM, INT
 VOID: ENUM, INT, BOOLEAN
 VOID: ENUM, OBJECT
diff --git a/app/core/gimppickable.c b/app/core/gimppickable.c
index 392b097..d264116 100644
--- a/app/core/gimppickable.c
+++ b/app/core/gimppickable.c
@@ -26,6 +26,8 @@
 
 #include "config.h"
 
+#include <string.h>
+
 #include <cairo.h>
 #include <gegl.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
@@ -222,19 +224,24 @@ gimp_pickable_pick_color (GimpPickable *pickable,
                           gint          y,
                           gboolean      sample_average,
                           gdouble       average_radius,
-                          GimpRGB      *color,
-                          gint         *color_index)
+                          gpointer      pixel,
+                          GimpRGB      *color)
 {
   const Babl *format;
-  gdouble     pixel[4];
+  gdouble     sample[4];
 
   g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), FALSE);
 
-  format = babl_format ("RGBA double");
+  format = gimp_pickable_get_format (pickable);
 
-  if (! gimp_pickable_get_pixel_at (pickable, x, y, format, pixel))
+  if (! gimp_pickable_get_pixel_at (pickable, x, y, format, sample))
     return FALSE;
 
+  gimp_rgba_set_pixel (color, format, sample);
+
+  if (pixel)
+    memcpy (pixel, sample, babl_format_get_bytes_per_pixel (format));
+
   if (sample_average)
     {
       gint    count        = 0;
@@ -242,42 +249,26 @@ gimp_pickable_pick_color (GimpPickable *pickable,
       gint    radius       = (gint) average_radius;
       gint    i, j;
 
+      format = babl_format ("RGBA double");
+
       for (i = x - radius; i <= x + radius; i++)
         for (j = y - radius; j <= y + radius; j++)
-          if (gimp_pickable_get_pixel_at (pickable, i, j, format, pixel))
+          if (gimp_pickable_get_pixel_at (pickable, i, j, format, sample))
             {
               count++;
 
-              color_avg[RED]   += pixel[RED];
-              color_avg[GREEN] += pixel[GREEN];
-              color_avg[BLUE]  += pixel[BLUE];
-              color_avg[ALPHA] += pixel[ALPHA];
+              color_avg[RED]   += sample[RED];
+              color_avg[GREEN] += sample[GREEN];
+              color_avg[BLUE]  += sample[BLUE];
+              color_avg[ALPHA] += sample[ALPHA];
             }
 
-      pixel[RED]   = color_avg[RED]   / count;
-      pixel[GREEN] = color_avg[GREEN] / count;
-      pixel[BLUE]  = color_avg[BLUE]  / count;
-      pixel[ALPHA] = color_avg[ALPHA] / count;
-    }
-
-  gimp_rgba_set_pixel (color, format, pixel);
-
-  if (color_index)
-    {
-      format = gimp_pickable_get_format (pickable);
-
-      if (babl_format_is_palette (format) && ! sample_average)
-        {
-          guchar indexed_pixel[4];
-
-          gimp_pickable_get_pixel_at (pickable, x, y, format, indexed_pixel);
+      sample[RED]   = color_avg[RED]   / count;
+      sample[GREEN] = color_avg[GREEN] / count;
+      sample[BLUE]  = color_avg[BLUE]  / count;
+      sample[ALPHA] = color_avg[ALPHA] / count;
 
-          *color_index = indexed_pixel[0];
-        }
-      else
-        {
-          *color_index = -1;
-        }
+      gimp_rgba_set_pixel (color, format, sample);
     }
 
   return TRUE;
diff --git a/app/core/gimppickable.h b/app/core/gimppickable.h
index 9dff48c..7308127 100644
--- a/app/core/gimppickable.h
+++ b/app/core/gimppickable.h
@@ -76,8 +76,8 @@ gboolean        gimp_pickable_pick_color            (GimpPickable *pickable,
                                                      gint          y,
                                                      gboolean      sample_average,
                                                      gdouble       average_radius,
-                                                     GimpRGB      *color,
-                                                     gint         *color_index);
+                                                     gpointer      pixel,
+                                                     GimpRGB      *color);
 
 
 #endif  /* __GIMP_PICKABLE_H__ */
diff --git a/app/display/gimpcursorview.c b/app/display/gimpcursorview.c
index 7cec9b5..4bd1aac 100644
--- a/app/display/gimpcursorview.c
+++ b/app/display/gimpcursorview.c
@@ -722,8 +722,8 @@ gimp_cursor_view_update_cursor (GimpCursorView   *view,
   gboolean      in_image;
   gchar         buf[32];
   const Babl   *sample_format;
+  guchar        pixel[32];
   GimpRGB       color;
-  gint          color_index;
   gdouble       xres;
   gdouble       yres;
 
@@ -759,12 +759,12 @@ gimp_cursor_view_update_cursor (GimpCursorView   *view,
                              (gint) floor (y),
                              view->priv->sample_merged,
                              FALSE, 0.0,
-                             &sample_format, &color, &color_index))
+                             &sample_format, pixel, &color))
     {
       gimp_color_frame_set_color (GIMP_COLOR_FRAME (view->priv->color_frame_1),
-                                  sample_format, &color, color_index);
+                                  FALSE, sample_format, pixel, &color);
       gimp_color_frame_set_color (GIMP_COLOR_FRAME (view->priv->color_frame_2),
-                                  sample_format, &color, color_index);
+                                  FALSE, sample_format, pixel, &color);
     }
   else
     {
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 9e3d874..08e4389 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -711,8 +711,8 @@ image_pick_color_invoker (GimpProcedure         *procedure,
                                            sample_average,
                                            average_radius,
                                            NULL,
-                                           &color,
-                                           NULL);
+                                           NULL,
+                                           &color);
         }
     }
 
diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c
index 7eb2609..10ff09c 100644
--- a/app/tools/gimpcolorpickertool.c
+++ b/app/tools/gimpcolorpickertool.c
@@ -64,17 +64,18 @@ static void   gimp_color_picker_tool_picked        (GimpColorTool       *color_t
                                                     gdouble              x,
                                                     gdouble              y,
                                                     const Babl          *sample_format,
-                                                    const GimpRGB       *color,
-                                                    gint                 color_index);
+                                                    gpointer             pixel,
+                                                    const GimpRGB       *color);
 
 static void   gimp_color_picker_tool_info_create   (GimpColorPickerTool *picker_tool);
 static void   gimp_color_picker_tool_info_response (GimpToolGui         *gui,
                                                     gint                 response_id,
                                                     GimpColorPickerTool *picker_tool);
 static void   gimp_color_picker_tool_info_update   (GimpColorPickerTool *picker_tool,
+                                                    gboolean             sample_average,
                                                     const Babl          *sample_format,
-                                                    const GimpRGB       *color,
-                                                    gint                 color_index);
+                                                    gpointer             pixel,
+                                                    const GimpRGB       *color);
 
 
 G_DEFINE_TYPE (GimpColorPickerTool, gimp_color_picker_tool,
@@ -277,8 +278,8 @@ gimp_color_picker_tool_picked (GimpColorTool      *color_tool,
                                gdouble             x,
                                gdouble             y,
                                const Babl         *sample_format,
-                               const GimpRGB      *color,
-                               gint                color_index)
+                               gpointer            pixel,
+                               const GimpRGB      *color)
 {
   GimpColorPickerTool    *picker_tool = GIMP_COLOR_PICKER_TOOL (color_tool);
   GimpColorPickerOptions *options;
@@ -289,13 +290,14 @@ gimp_color_picker_tool_picked (GimpColorTool      *color_tool,
     gimp_color_picker_tool_info_create (picker_tool);
 
   if (picker_tool->gui)
-    gimp_color_picker_tool_info_update (picker_tool, sample_format,
-                                        color, color_index);
+    gimp_color_picker_tool_info_update (picker_tool,
+                                        GIMP_COLOR_OPTIONS (options)->sample_average,
+                                        sample_format, pixel, color);
 
   GIMP_COLOR_TOOL_CLASS (parent_class)->picked (color_tool, pick_state,
                                                 x, y,
-                                                sample_format, color,
-                                                color_index);
+                                                sample_format,
+                                                pixel, color);
 }
 
 static void
@@ -380,9 +382,10 @@ gimp_color_picker_tool_info_response (GimpToolGui         *gui,
 
 static void
 gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
+                                    gboolean             sample_average,
                                     const Babl          *sample_format,
-                                    const GimpRGB       *color,
-                                    gint                 color_index)
+                                    gpointer             pixel,
+                                    const GimpRGB       *color)
 {
   GimpTool *tool = GIMP_TOOL (picker_tool);
 
@@ -395,9 +398,9 @@ gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_tool,
                              color);
 
   gimp_color_frame_set_color (GIMP_COLOR_FRAME (picker_tool->color_frame1),
-                              sample_format, color, color_index);
+                              sample_average, sample_format, pixel, color);
   gimp_color_frame_set_color (GIMP_COLOR_FRAME (picker_tool->color_frame2),
-                              sample_format, color, color_index);
+                              sample_average, sample_format, pixel, color);
 
   gimp_tool_gui_show (picker_tool->gui);
 }
diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c
index f307ef4..c2dbee7 100644
--- a/app/tools/gimpcolortool.c
+++ b/app/tools/gimpcolortool.c
@@ -106,15 +106,15 @@ static gboolean   gimp_color_tool_real_pick  (GimpColorTool         *color_tool,
                                               gint                   x,
                                               gint                   y,
                                               const Babl           **sample_format,
-                                              GimpRGB               *color,
-                                              gint                  *color_index);
+                                              gpointer               pixel,
+                                              GimpRGB               *color);
 static void   gimp_color_tool_real_picked    (GimpColorTool         *color_tool,
                                               GimpColorPickState     pick_state,
                                               gdouble                x,
                                               gdouble                y,
                                               const Babl            *sample_format,
-                                              const GimpRGB         *color,
-                                              gint                   color_index);
+                                              gpointer               pixel,
+                                              const GimpRGB         *color);
 
 static void   gimp_color_tool_pick           (GimpColorTool         *tool,
                                               GimpColorPickState     pick_state,
@@ -142,14 +142,14 @@ gimp_color_tool_class_init (GimpColorToolClass *klass)
                   G_SIGNAL_RUN_FIRST,
                   G_STRUCT_OFFSET (GimpColorToolClass, picked),
                   NULL, NULL,
-                  gimp_marshal_VOID__ENUM_DOUBLE_DOUBLE_POINTER_BOXED_INT,
+                  gimp_marshal_VOID__ENUM_DOUBLE_DOUBLE_POINTER_POINTER_BOXED,
                   G_TYPE_NONE, 6,
                   GIMP_TYPE_COLOR_PICK_STATE,
                   G_TYPE_DOUBLE,
                   G_TYPE_DOUBLE,
                   G_TYPE_POINTER,
-                  GIMP_TYPE_RGB | G_SIGNAL_TYPE_STATIC_SCOPE,
-                  G_TYPE_INT);
+                  G_TYPE_POINTER,
+                  GIMP_TYPE_RGB | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   object_class->finalize     = gimp_color_tool_finalize;
 
@@ -583,8 +583,8 @@ gimp_color_tool_real_pick (GimpColorTool  *color_tool,
                            gint            x,
                            gint            y,
                            const Babl    **sample_format,
-                           GimpRGB        *color,
-                           gint           *color_index)
+                           gpointer        pixel,
+                           GimpRGB        *color)
 {
   GimpTool  *tool  = GIMP_TOOL (color_tool);
   GimpImage *image = gimp_display_get_image (tool->display);
@@ -597,8 +597,8 @@ gimp_color_tool_real_pick (GimpColorTool  *color_tool,
                                 color_tool->options->sample_average,
                                 color_tool->options->average_radius,
                                 sample_format,
-                                color,
-                                color_index);
+                                pixel,
+                                color);
 }
 
 static void
@@ -607,8 +607,8 @@ gimp_color_tool_real_picked (GimpColorTool      *color_tool,
                              gdouble             x,
                              gdouble             y,
                              const Babl         *sample_format,
-                             const GimpRGB      *color,
-                             gint                color_index)
+                             gpointer            pixel,
+                             const GimpRGB      *color)
 {
   GimpTool    *tool = GIMP_TOOL (color_tool);
   GimpContext *context;
@@ -628,9 +628,10 @@ gimp_color_tool_real_picked (GimpColorTool      *color_tool,
           if (widget)
             {
               GtkWidget *editor = gtk_bin_get_child (GTK_BIN (widget));
+              guchar    *index  = pixel;
 
               gimp_colormap_editor_set_index (GIMP_COLORMAP_EDITOR (editor),
-                                              color_index, NULL);
+                                              *index, NULL);
             }
         }
 
@@ -714,18 +715,18 @@ gimp_color_tool_pick (GimpColorTool      *tool,
 {
   GimpColorToolClass *klass;
   const Babl         *sample_format;
+  guchar              pixel[32];
   GimpRGB             color;
-  gint                color_index;
 
   klass = GIMP_COLOR_TOOL_GET_CLASS (tool);
 
   if (klass->pick &&
-      klass->pick (tool, x, y, &sample_format, &color, &color_index))
+      klass->pick (tool, x, y, &sample_format, pixel, &color))
     {
       g_signal_emit (tool, gimp_color_tool_signals[PICKED], 0,
                      pick_state,
                      (gdouble) x, (gdouble) y,
-                     sample_format, &color, color_index);
+                     sample_format, pixel, &color);
     }
 }
 
diff --git a/app/tools/gimpcolortool.h b/app/tools/gimpcolortool.h
index b71bef0..56b949c 100644
--- a/app/tools/gimpcolortool.h
+++ b/app/tools/gimpcolortool.h
@@ -60,8 +60,8 @@ struct _GimpColorToolClass
                        gint                x,
                        gint                y,
                        const Babl        **sample_format,
-                       GimpRGB            *color,
-                       gint               *color_index);
+                       gpointer            pixel,
+                       GimpRGB            *color);
 
   /*  signals  */
   void     (* picked) (GimpColorTool      *tool,
@@ -69,8 +69,8 @@ struct _GimpColorToolClass
                        gdouble             x,
                        gdouble             y,
                        const Babl         *sample_format,
-                       const GimpRGB      *color,
-                       gint                color_index);
+                       gpointer            pixel,
+                       const GimpRGB      *color);
 };
 
 
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index 3a90abd..f69810b 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -94,15 +94,15 @@ static gboolean  gimp_image_map_tool_pick_color     (GimpColorTool    *color_too
                                                      gint              x,
                                                      gint              y,
                                                      const Babl      **sample_format,
-                                                     GimpRGB          *color,
-                                                     gint             *color_index);
+                                                     gpointer          pixel,
+                                                     GimpRGB          *color);
 static void      gimp_image_map_tool_color_picked   (GimpColorTool    *color_tool,
                                                      GimpColorPickState pick_state,
                                                      gdouble           x,
                                                      gdouble           y,
                                                      const Babl       *sample_format,
-                                                     const GimpRGB    *color,
-                                                     gint              color_index);
+                                                     gpointer          pixel,
+                                                     const GimpRGB    *color);
 
 static void      gimp_image_map_tool_real_reset     (GimpImageMapTool *im_tool);
 
@@ -550,8 +550,8 @@ gimp_image_map_tool_pick_color (GimpColorTool  *color_tool,
                                 gint            x,
                                 gint            y,
                                 const Babl    **sample_format,
-                                GimpRGB        *color,
-                                gint           *color_index)
+                                gpointer        pixel,
+                                GimpRGB        *color)
 {
   GimpImageMapTool *tool = GIMP_IMAGE_MAP_TOOL (color_tool);
   gint              off_x, off_y;
@@ -565,7 +565,7 @@ gimp_image_map_tool_pick_color (GimpColorTool  *color_tool,
                                    y - off_y,
                                    color_tool->options->sample_average,
                                    color_tool->options->average_radius,
-                                   color, color_index);
+                                   pixel, color);
 }
 
 static void
@@ -574,8 +574,8 @@ gimp_image_map_tool_color_picked (GimpColorTool      *color_tool,
                                   gdouble             x,
                                   gdouble             y,
                                   const Babl         *sample_format,
-                                  const GimpRGB      *color,
-                                  gint                color_index)
+                                  gpointer            pixel,
+                                  const GimpRGB      *color)
 {
   GimpImageMapTool *tool = GIMP_IMAGE_MAP_TOOL (color_tool);
   gpointer          identifier;
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index 5df85b1..b388d80 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -409,37 +409,42 @@ gimp_color_frame_set_has_color_area (GimpColorFrame *frame,
 
 /**
  * gimp_color_frame_set_color:
- * @frame:         The #GimpColorFrame.
- * @sample_format: The format of the #GimpDrawable or #GimpImage the @color
- *                 was picked from.
- * @color:         The @color to set.
- * @color_index:   The @color's index. This value is ignored unless
- *                 @sample_format is an indexed format.
+ * @frame:          The #GimpColorFrame.
+ * @sample_average: The set @color is the result of averaging
+ * @sample_format:  The format of the #GimpDrawable or #GimpImage the @color
+ *                  was picked from.
+ * @pixel:          The raw pixel in @sample_format.
+ * @color:          The @color to set.
  *
- * Sets the color sample to display in the #GimpColorFrame.
+ * Sets the color sample to display in the #GimpColorFrame. if
+ * @sample_average is %TRUE, @pixel represents the sample at the
+ * center of the average area and will not be displayed.
  **/
 void
 gimp_color_frame_set_color (GimpColorFrame *frame,
+                            gboolean        sample_average,
                             const Babl     *sample_format,
-                            const GimpRGB  *color,
-                            gint            color_index)
+                            gpointer        pixel,
+                            const GimpRGB  *color)
 {
   g_return_if_fail (GIMP_IS_COLOR_FRAME (frame));
   g_return_if_fail (color != NULL);
 
-  if (frame->sample_valid                   &&
-      frame->sample_format == sample_format &&
-      frame->color_index == color_index     &&
+  if (frame->sample_valid                     &&
+      frame->sample_average == sample_average &&
+      frame->sample_format == sample_format   &&
       gimp_rgba_distance (&frame->color, color) < 0.0001)
     {
       frame->color = *color;
       return;
     }
 
-  frame->sample_valid  = TRUE;
-  frame->sample_format = sample_format;
-  frame->color         = *color;
-  frame->color_index   = color_index;
+  frame->sample_valid   = TRUE;
+  frame->sample_average = sample_average;
+  frame->sample_format  = sample_format;
+  frame->color          = *color;
+
+  memcpy (frame->pixel, pixel, babl_format_get_bytes_per_pixel (sample_format));
 
   gimp_color_frame_update (frame);
 }
@@ -549,7 +554,19 @@ gimp_color_frame_update (GimpColorFrame *frame)
                 break;
               }
 
-            gimp_rgba_get_pixel (&frame->color, print_format, print_pixel);
+            if (frame->sample_average)
+              {
+                /* FIXME: this is broken: can't use the averaged sRGB GimpRGB
+                 * value for displaying pixel values when color management
+                 * is enabled
+                 */
+                gimp_rgba_get_pixel (&frame->color, print_format, print_pixel);
+              }
+            else
+              {
+                babl_process (babl_fish (frame->sample_format, print_format),
+                              frame->pixel, print_pixel, 1);
+              }
 
             values = gimp_babl_print_pixel (print_format, print_pixel);
           }
@@ -584,9 +601,8 @@ gimp_color_frame_update (GimpColorFrame *frame)
 
                     g_free (tmp);
 
-                    /* color_index will be -1 for an averaged sample */
-                    if (frame->color_index >= 0)
-                      values[4] = g_strdup_printf ("%d", frame->color_index);
+                    if (! frame->sample_average)
+                      values[4] = g_strdup_printf ("%d", frame->pixel[0]);
                   }
               }
           }
diff --git a/app/widgets/gimpcolorframe.h b/app/widgets/gimpcolorframe.h
index d77d2fd..b9131f1 100644
--- a/app/widgets/gimpcolorframe.h
+++ b/app/widgets/gimpcolorframe.h
@@ -37,9 +37,10 @@ struct _GimpColorFrame
   GimpFrame           parent_instance;
 
   gboolean            sample_valid;
+  gboolean            sample_average;
   const Babl         *sample_format;
+  guchar              pixel[32];
   GimpRGB             color;
-  gint                color_index;
 
   GimpColorFrameMode  frame_mode;
 
@@ -78,9 +79,10 @@ void        gimp_color_frame_set_has_color_area (GimpColorFrame     *frame,
                                                  gboolean            has_color_area);
 
 void        gimp_color_frame_set_color          (GimpColorFrame     *frame,
+                                                 gboolean            sample_average,
                                                  const Babl         *format,
-                                                 const GimpRGB      *color,
-                                                 gint                color_index);
+                                                 gpointer            pixel,
+                                                 const GimpRGB      *color);
 void        gimp_color_frame_set_invalid        (GimpColorFrame     *frame);
 
 
diff --git a/app/widgets/gimpsamplepointeditor.c b/app/widgets/gimpsamplepointeditor.c
index 739d662..1dd6242 100644
--- a/app/widgets/gimpsamplepointeditor.c
+++ b/app/widgets/gimpsamplepointeditor.c
@@ -467,8 +467,8 @@ gimp_sample_point_editor_update (GimpSamplePointEditor *editor)
           GimpSamplePoint *sample_point = list->data;
           GimpColorFrame  *color_frame;
           const Babl      *format;
+          guchar           pixel[32];
           GimpRGB          color;
-          gint             color_index;
 
           editor->dirty[i] = FALSE;
 
@@ -480,11 +480,11 @@ gimp_sample_point_editor_update (GimpSamplePointEditor *editor)
                                      editor->sample_merged,
                                      FALSE, 0.0,
                                      &format,
-                                     &color,
-                                     &color_index))
+                                     pixel,
+                                     &color))
             {
-              gimp_color_frame_set_color (color_frame, format,
-                                          &color, color_index);
+              gimp_color_frame_set_color (color_frame, FALSE,
+                                          format, pixel, &color);
             }
           else
             {
diff --git a/app/widgets/gimpselectioneditor.c b/app/widgets/gimpselectioneditor.c
index c28dddc..3ee38ad 100644
--- a/app/widgets/gimpselectioneditor.c
+++ b/app/widgets/gimpselectioneditor.c
@@ -278,7 +278,7 @@ gimp_selection_view_button_press (GtkWidget           *widget,
                              options->sample_merged,
                              FALSE, 0.0,
                              NULL,
-                             &color, NULL))
+                             NULL, &color))
     {
       gimp_channel_select_by_color (gimp_image_get_mask (image_editor->image),
                                     drawable,
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index de8125c..da9d049 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -483,8 +483,8 @@ HELP
                                        sample_average,
                                        average_radius,
                                        NULL,
-                                       &color,
-                                       NULL);
+                                       NULL,
+                                       &color);
     }
 }
 CODE


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