[gimp/gimp-2-8] app: fix the curves tool to not warn on layers without alpha



commit 051b1f0bd9b1c50c09ac3453d6bffed6508c3dce
Author: Michael Natterer <mitch gimp org>
Date:   Mon Dec 28 02:04:46 2015 +0100

    app: fix the curves tool to not warn on layers without alpha
    
    when adding control points to all channels with control-click. It was
    looking up curve points based on a -1 alpha value.
    
    (cherry picked from commit e9a38c320d03adda0ae2acd5f6646995a21f4369)

 app/tools/gimpcurvestool.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index fa82ba2..acb0c78 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -286,21 +286,26 @@ gimp_curves_tool_button_release (GimpTool              *tool,
     }
   else if (state & gimp_get_toggle_behavior_mask ())
     {
-      gint i;
+      GimpHistogramChannel channel;
 
-      for (i = 0; i < 5; i++)
+      for (channel = GIMP_HISTOGRAM_VALUE;
+           channel <= GIMP_HISTOGRAM_ALPHA;
+           channel++)
         {
-          GimpCurve *curve = config->curve[i];
-          gdouble    value = c_tool->picked_color[i];
+          GimpCurve *curve = config->curve[channel];
+          gdouble    value = c_tool->picked_color[channel];
           gint       closest;
 
-          closest = gimp_curve_get_closest_point (curve, value);
+          if (value != -1)
+            {
+              closest = gimp_curve_get_closest_point (curve, value);
 
-          gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph),
-                                        closest);
+              gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph),
+                                            closest);
 
-          gimp_curve_set_point (curve, closest,
-                                value, gimp_curve_map_value (curve, value));
+              gimp_curve_set_point (curve, closest,
+                                    value, gimp_curve_map_value (curve, value));
+            }
         }
     }
 
@@ -377,6 +382,8 @@ gimp_curves_tool_color_picked (GimpColorTool      *color_tool,
 
   if (gimp_drawable_has_alpha (drawable))
     tool->picked_color[GIMP_HISTOGRAM_ALPHA] = color->a;
+  else
+    tool->picked_color[GIMP_HISTOGRAM_ALPHA] = -1;
 
   tool->picked_color[GIMP_HISTOGRAM_VALUE] = MAX (MAX (color->r, color->g),
                                                   color->b);


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