diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-21 12:20:32 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-21 12:20:32 +0400 |
commit | 49d3766ceb17082fd64cdc0f01224237f1098564 (patch) | |
tree | 060e3303a7fc4876dd5ba7521705de5ee499077c /source/blender/compositor/operations/COM_ColorCurveOperation.cpp | |
parent | 77f47799ddff99da672aa58e5d989237403e7707 (diff) |
code cleanup: use math functions for curve compo code.
Diffstat (limited to 'source/blender/compositor/operations/COM_ColorCurveOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_ColorCurveOperation.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index 44784837301..ff2cf96d0ad 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -76,17 +76,16 @@ void ColorCurveOperation::executePixel(float output[4], float x, float y, PixelS this->m_inputFacProgram->read(fac, x, y, sampler); this->m_inputImageProgram->read(image, x, y, sampler); - if (*fac >= 1.0f) + if (*fac >= 1.0f) { curvemapping_evaluate_premulRGBF(workingCopy, output, image); + } else if (*fac <= 0.0f) { copy_v3_v3(output, image); } else { - float col[4], mfac = 1.0f - *fac; + float col[4]; curvemapping_evaluate_premulRGBF(workingCopy, col, image); - output[0] = mfac * image[0] + *fac * col[0]; - output[1] = mfac * image[1] + *fac * col[1]; - output[2] = mfac * image[2] + *fac * col[2]; + interp_v3_v3v3(output, image, col, *fac); } output[3] = image[3]; MEM_freeN(workingCopy); @@ -131,21 +130,19 @@ void ConstantLevelColorCurveOperation::executePixel(float output[4], float x, fl float fac[4]; float image[4]; - this->m_inputFacProgram->read(fac, x, y, sampler); this->m_inputImageProgram->read(image, x, y, sampler); - if (*fac >= 1.0f) + if (*fac >= 1.0f) { curvemapping_evaluate_premulRGBF(this->m_curveMapping, output, image); + } else if (*fac <= 0.0f) { copy_v3_v3(output, image); } else { - float col[4], mfac = 1.0f - *fac; + float col[4]; curvemapping_evaluate_premulRGBF(this->m_curveMapping, col, image); - output[0] = mfac * image[0] + *fac * col[0]; - output[1] = mfac * image[1] + *fac * col[1]; - output[2] = mfac * image[2] + *fac * col[2]; + interp_v3_v3v3(output, image, col, *fac); } output[3] = image[3]; } |