Merging r58475 through r58700 from trunk into soc-2013-depsgraph_mt
[blender.git] / source / blender / compositor / operations / COM_MixColorOperation.cpp
index 378cfbd9b6cc4e97d5e1d47912b94959452daccc..6919a636aeb40713aa424ec979f82ecc35564be5 100644 (file)
@@ -31,16 +31,17 @@ MixColorOperation::MixColorOperation() : MixBaseOperation()
        /* pass */
 }
 
-void MixColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
+void MixColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
 {
        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,12 +54,15 @@ void MixColorOperation::executePixel(float *outputValue, float x, float y, Pixel
                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);
-               outputValue[0] = valuem * (inputColor1[0]) + value * tmpr;
-               outputValue[1] = valuem * (inputColor1[1]) + value * tmpg;
-               outputValue[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);
        }
-       outputValue[3] = inputColor1[3];
+       else {
+               copy_v3_v3(output, inputColor1);
+       }
+       output[3] = inputColor1[3];
 
-       clampIfNeeded(outputValue);
+       clampIfNeeded(output);
 }