[gimp] Issue #1980 - Color picker wrong results when picking from non-sRGB...



commit a2fe90aa540942f7901bf88718e2800632c05242
Author: Michael Natterer <mitch gimp org>
Date:   Mon Aug 6 12:39:36 2018 +0200

    Issue #1980 - Color picker wrong results when picking from non-sRGB...
    
    ...image using "Sample Average"
    
    In GimpPickable, create the "RaGaBaA double" format used for averaging
    with the space of the source pixels.

 app/core/gimppickable.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimppickable.c b/app/core/gimppickable.c
index b4b8987c0c..e47b37e486 100644
--- a/app/core/gimppickable.c
+++ b/app/core/gimppickable.c
@@ -74,13 +74,16 @@ gimp_pickable_real_get_pixel_average (GimpPickable        *pickable,
                                       const Babl          *format,
                                       gpointer             pixel)
 {
-  const Babl *average_format = babl_format ("RaGaBaA double");
-  gdouble     average[4]     = {};
-  gint        n              = 0;
+  const Babl *average_format;
+  gdouble     average[4] = { 0, };
+  gint        n          = 0;
   gint        x;
   gint        y;
   gint        c;
 
+  average_format = babl_format_with_space ("RaGaBaA double",
+                                           babl_format_get_space (format));
+
   for (y = rect->y; y < rect->y + rect->height; y++)
     {
       for (x = rect->x; x < rect->x + rect->width; x++)
@@ -362,7 +365,8 @@ gimp_pickable_pick_color (GimpPickable *pickable,
     {
       gint radius = floor (average_radius);
 
-      format = babl_format ("RaGaBaA double");
+      format = babl_format_with_space ("RaGaBaA double",
+                                       babl_format_get_space (format));
 
       gimp_pickable_get_pixel_average (pickable,
                                        GEGL_RECTANGLE (x - radius,


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