Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/colortools.c
| Show First 20 Lines • Show All 763 Lines • ▼ Show 20 Lines | for (int a = 0; a <= CM_TABLE; a++) { | ||||
| float cur_x = cuma->mintable + range * (float)a; | float cur_x = cuma->mintable + range * (float)a; | ||||
| cmp[a].x = cur_x; | cmp[a].x = cur_x; | ||||
| /* Get the first point with x coordinate larger than cur_x. */ | /* Get the first point with x coordinate larger than cur_x. */ | ||||
| while (cur_x >= point[0] && point != lastpoint) { | while (cur_x >= point[0] && point != lastpoint) { | ||||
| point += 2; | point += 2; | ||||
| } | } | ||||
| /* Check if we are on or outside the start or end point. */ | |||||
| if (point == firstpoint || (point == lastpoint && cur_x >= point[0])) { | if (point == firstpoint || (point == lastpoint && cur_x >= point[0])) { | ||||
| 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); | cmp[a].y = curvemap_calc_extend(cuma, cur_x, firstpoint, lastpoint); | ||||
| } | } | ||||
| } | |||||
| else { | else { | ||||
| float fac1 = point[0] - point[-2]; | float fac1 = point[0] - point[-2]; | ||||
| float fac2 = point[0] - cur_x; | float fac2 = point[0] - cur_x; | ||||
| if (fac1 > FLT_EPSILON) { | if (fac1 > FLT_EPSILON) { | ||||
| fac1 = fac2 / fac1; | fac1 = fac2 / fac1; | ||||
| } | } | ||||
| else { | else { | ||||
| fac1 = 0.0f; | fac1 = 0.0f; | ||||
| ▲ Show 20 Lines • Show All 1,024 Lines • Show Last 20 Lines | |||||