gimp r25638 - in trunk: . app/core



Author: neo
Date: Sun May 11 12:25:36 2008
New Revision: 25638
URL: http://svn.gnome.org/viewvc/gimp?rev=25638&view=rev

Log:
2008-05-11  Sven Neumann  <sven gimp org>

	* app/core/gimpcurve.[ch] (gimp_curve_map): minor cleanup.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpcurve.c
   trunk/app/core/gimpcurve.h

Modified: trunk/app/core/gimpcurve.c
==============================================================================
--- trunk/app/core/gimpcurve.c	(original)
+++ trunk/app/core/gimpcurve.c	Sun May 11 12:25:36 2008
@@ -662,30 +662,25 @@
 
 gdouble
 gimp_curve_map (GimpCurve *curve,
-                gdouble    x)
+                gdouble    value)
 {
-  gdouble value;
-
   g_return_val_if_fail (GIMP_IS_CURVE (curve), 0.0);
 
-  if (x < 0.0)
+  if (value < 0.0)
     {
-      value = curve->samples[0];
+      return curve->samples[0];
     }
-  else if (x >= 1.0)
+  else if (value >= 1.0)
     {
-      value = curve->samples[curve->n_samples - 1];
+      return curve->samples[curve->n_samples - 1];
     }
   else /* interpolate the curve */
     {
-      gint    index = floor (x * (gdouble) (curve->n_samples - 1));
-      gdouble f     = x * (gdouble) (curve->n_samples - 1) - index;
+      gint    index = floor (value * (gdouble) (curve->n_samples - 1));
+      gdouble f     = value * (gdouble) (curve->n_samples - 1) - index;
 
-      value = ((1.0 - f) * curve->samples[index    ] +
-                      f  * curve->samples[index + 1]);
+      return (1.0 - f) * curve->samples[index] + f  * curve->samples[index + 1];
     }
-
-  return value;
 }
 
 void

Modified: trunk/app/core/gimpcurve.h
==============================================================================
--- trunk/app/core/gimpcurve.h	(original)
+++ trunk/app/core/gimpcurve.h	Sun May 11 12:25:36 2008
@@ -88,7 +88,7 @@
                                               gdouble        y);
 
 gdouble         gimp_curve_map               (GimpCurve     *curve,
-                                              gdouble        x);
+                                              gdouble        value);
 
 void            gimp_curve_get_uchar         (GimpCurve     *curve,
                                               gint           n_samples,



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