[gegl] workshop: fix copy paste typo in gegl:saturation-hue-constant



commit 2acd45882b1f0bcf3bfadf684080807c9d51a4d2
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri Jun 28 23:49:29 2019 +0200

    workshop: fix copy paste typo in gegl:saturation-hue-constant
    
    The green coefficient for comuting luminance was being used for both
    green and blue, yielding a wrong desaturated value being used for all
    computation. re issue #171

 operations/workshop/saturation-hue-constant.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/operations/workshop/saturation-hue-constant.c b/operations/workshop/saturation-hue-constant.c
index 1a9900737..1f9ea1ec2 100644
--- a/operations/workshop/saturation-hue-constant.c
+++ b/operations/workshop/saturation-hue-constant.c
@@ -60,16 +60,19 @@ process (GeglOperation       *operation,
   glong i;
   float scale = o->scale;
   float rscale = 1.0f - o->scale;
-  double red_luminance, green_luminance, blue_luminance;
+  double luminance[3];
+  float luminance_f[3];
 
   babl_space_get_rgb_luminance (space,
-    &red_luminance, &green_luminance, &blue_luminance);
+    &luminance[0], &luminance[1], &luminance[2]);
+  for (int c = 0; c < 3; c ++)
+    luminance_f[c] = luminance[c];
 
   for (i = 0; i < n_pixels; i++)
     {
-      gfloat desaturated = (in[0] * red_luminance +
-                            in[1] * green_luminance +
-                            in[2] * green_luminance) * rscale;
+      gfloat desaturated = (in[0] * luminance_f[0] +
+                            in[1] * luminance_f[1] +
+                            in[2] * luminance_f[2]) * rscale;
       for (int c = 0; c < 3; c ++)
         out[c] = desaturated + in[c] * scale;
       out[3] = in[3];


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