[gimp] libgimpcolor: disable gimp_rgb_clamp() in GimpParamSpecRGB



commit ff44cb59d36bbec5cd72b44025dce5d484365b6f
Author: Michael Natterer <mitch gimp org>
Date:   Tue May 16 22:39:55 2017 +0200

    libgimpcolor: disable gimp_rgb_clamp() in GimpParamSpecRGB
    
    so from now on all GimpRGB object properties will allow unbounded
    sRGB, let's see what happens.

 libgimpcolor/gimprgb.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libgimpcolor/gimprgb.c b/libgimpcolor/gimprgb.c
index b6ad3e2..89062b8 100644
--- a/libgimpcolor/gimprgb.c
+++ b/libgimpcolor/gimprgb.c
@@ -622,6 +622,7 @@ struct _GimpParamSpecRGB
   GParamSpecBoxed  parent_instance;
 
   gboolean         has_alpha;
+  gboolean         validate; /* change this to enable [0.0...1.0] */
   GimpRGB          default_value;
 };
 
@@ -700,9 +701,10 @@ static gboolean
 gimp_param_rgb_validate (GParamSpec *pspec,
                          GValue     *value)
 {
-  GimpRGB *rgb = value->data[0].v_pointer;
+  GimpParamSpecRGB *rgb_spec = GIMP_PARAM_SPEC_RGB (pspec);
+  GimpRGB          *rgb      = value->data[0].v_pointer;
 
-  if (rgb)
+  if (rgb_spec->validate && rgb)
     {
       GimpRGB oval = *rgb;
 
@@ -711,7 +713,7 @@ gimp_param_rgb_validate (GParamSpec *pspec,
       return (oval.r != rgb->r ||
               oval.g != rgb->g ||
               oval.b != rgb->b ||
-              (GIMP_PARAM_SPEC_RGB (pspec)->has_alpha && oval.a != rgb->a));
+              (rgb_spec->has_alpha && oval.a != rgb->a));
     }
 
   return FALSE;


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