diff options
Diffstat (limited to 'source/blender/blenkernel/intern/colortools.c')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index cbd6ff46933..863d6351738 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -769,8 +769,17 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) point += 2; } + /* Check if we are on or outside the start or end point. */ if (point == firstpoint || (point == lastpoint && cur_x >= point[0])) { - cmp[a].y = curvemap_calc_extend(cuma, cur_x, firstpoint, lastpoint); + if (compare_ff(cur_x, point[0], 1e-6f)) { + /* When on the point exactly, use the value directly to avoid precision + * issues with extrapolation of extreme slopes. */ + cmp[a].y = point[1]; + } + else { + /* Extrapolate values that lie outside the start and end point. */ + cmp[a].y = curvemap_calc_extend(cuma, cur_x, firstpoint, lastpoint); + } } else { float fac1 = point[0] - point[-2]; |