gimp r25647 - in trunk: . app/core



Author: neo
Date: Tue May 13 07:20:23 2008
New Revision: 25647
URL: http://svn.gnome.org/viewvc/gimp?rev=25647&view=rev

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

	* app/core/gimpcurve-map.c (gimp_curve_map_value): simplified 
the
	general case.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpcurve-map.c

Modified: trunk/app/core/gimpcurve-map.c
==============================================================================
--- trunk/app/core/gimpcurve-map.c	(original)
+++ trunk/app/core/gimpcurve-map.c	Tue May 13 07:20:23 2008
@@ -49,10 +49,19 @@
     }
   else  /* interpolate the curve */
     {
-      gint    index = floor (value * (gdouble) (curve->n_samples - 1));
-      gdouble f     = value * (gdouble) (curve->n_samples - 1) - index;
+      gdouble f;
+      gint    index;
 
-      return (1.0 - f) * curve->samples[index] + f  * curve->samples[index + 1];
+      /*  map value to the sample space  */
+      value = value * (curve->n_samples - 1);
+
+      /*  determine the indices of the closest sample points  */
+      index = (gint) value;
+
+      /*  calculate the position between the sample points  */
+      f = value - index;
+
+      return (1.0 - f) * curve->samples[index] + f * curve->samples[index + 1];
     }
 }
 



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