app: improve curved gradient segment sampling

Improve the sampling performance of curved gradient segments, and
its behavior when the segment's midpoint is close to one of its
limits.
This commit is contained in:
Ell 2017-08-12 11:56:21 -04:00
parent 1b2a395e88
commit 1f3030eb41
1 changed files with 4 additions and 2 deletions

View File

@ -2179,9 +2179,11 @@ gimp_gradient_calc_curved_factor (gdouble middle,
gdouble pos)
{
if (middle < EPSILON)
middle = EPSILON;
return 1.0;
else if (1.0 - middle < EPSILON)
return 0.0;
return pow (pos, log (0.5) / log (middle));
return exp (-G_LN2 * log (pos) / log (middle));
}
static inline gdouble