simplified the general case.

2008-05-13  Sven Neumann  <sven@gimp.org>

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


svn path=/trunk/; revision=25647
This commit is contained in:
Sven Neumann 2008-05-13 07:20:23 +00:00 committed by Sven Neumann
parent 06603cb0d4
commit 1a67f2b549
2 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,9 @@
2008-05-11 Sven Neumann <sven@gimp.org>
2008-05-13 Sven Neumann <sven@gimp.org>
* app/core/gimpcurve-map.c (gimp_curve_map_value): simplified the
general case.
2008-05-13 Sven Neumann <sven@gimp.org>
* app/core/gimpcurve.[ch]: keep a boolean flag to identify an
identity mapping. Set it to TRUE when the curve is reset.

View File

@ -49,10 +49,19 @@ gimp_curve_map_value (GimpCurve *curve,
}
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];
}
}