Merging r58475 through r58700 from trunk into soc-2013-depsgraph_mt
[blender.git] / source / blender / compositor / operations / COM_MixColorOperation.cpp
index f8aca92abc784c9b397cc122087234aa97877da3..6919a636aeb40713aa424ec979f82ecc35564be5 100644 (file)
@@ -35,12 +35,13 @@ void MixColorOperation::executePixel(float output[4], float x, float y, PixelSam
 {
        float inputColor1[4];
        float inputColor2[4];
-       float value;
+       float inputValue[4];
 
-       this->m_inputValueOperation->read(&value, x, y, sampler);
-       this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler);
-       this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler);
+       this->m_inputValueOperation->read(inputValue, x, y, sampler);
+       this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
+       this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
 
+       float value = inputValue[0];
        if (this->useValueAlphaMultiply()) {
                value *= inputColor2[3];
        }
@@ -53,9 +54,12 @@ void MixColorOperation::executePixel(float output[4], float x, float y, PixelSam
                float tmpr, tmpg, tmpb;
                rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
                hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
-               output[0] = valuem * (inputColor1[0]) + value * tmpr;
-               output[1] = valuem * (inputColor1[1]) + value * tmpg;
-               output[2] = valuem * (inputColor1[2]) + value * tmpb;
+               output[0] = (valuem * inputColor1[0]) + (value * tmpr);
+               output[1] = (valuem * inputColor1[1]) + (value * tmpg);
+               output[2] = (valuem * inputColor1[2]) + (value * tmpb);
+       }
+       else {
+               copy_v3_v3(output, inputColor1);
        }
        output[3] = inputColor1[3];