diff options
Diffstat (limited to 'source/blender/compositor/operations')
70 files changed, 622 insertions, 434 deletions
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp index 2dba9572ee8..3e80de78223 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp @@ -34,13 +34,13 @@ void AlphaOverKeyOperation::executePixel(float* outputValue, float x, float y, P inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers); inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); - if(inputOverColor[3]<=0.0f) { + if (inputOverColor[3]<=0.0f) { outputValue[0] = inputColor1[0]; outputValue[1] = inputColor1[1]; outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if(value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp index 9deb00ae71a..48762e6370e 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp @@ -35,13 +35,13 @@ void AlphaOverMixedOperation::executePixel(float* outputValue, float x, float y, inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers); inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); - if(inputOverColor[3]<=0.0f) { + if (inputOverColor[3]<=0.0f) { outputValue[0] = inputColor1[0]; outputValue[1] = inputColor1[1]; outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if(value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp index 635a6308601..c46f3a04113 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp @@ -35,13 +35,13 @@ void AlphaOverPremultiplyOperation::executePixel(float* outputValue, float x, fl inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); /* Zero alpha values should still permit an add of RGB data */ - if(inputOverColor[3]<0.0f) { + if (inputOverColor[3]<0.0f) { outputValue[0] = inputColor1[0]; outputValue[1] = inputColor1[1]; outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if(value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp index 729d04c182e..3d8cd13229f 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp @@ -43,7 +43,8 @@ void AntiAliasOperation::initExecution() { void AntiAliasOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) { if (y < 0 || y >= this->height || x < 0 || x >= this->width) { color[0] = 0.0f; - } else { + } + else { int offset = y*this->width + x; color[0] = buffer[offset]/255.0f; } @@ -62,7 +63,8 @@ bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe rcti imageInput; if (this->buffer) { return false; - } else { + } + else { NodeOperation* operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp index 5743b388705..8d507a754d5 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp @@ -89,7 +89,8 @@ void BilateralBlurOperation::executePixel(float* color, int x, int y, MemoryBuff color[1] = blurColor[1]/blurDivider; color[2] = blurColor[2]/blurDivider; color[3] = blurColor[3]/blurDivider; - } else { + } + else { color[0] = 0.0f; color[1] = 0.0f; color[2] = 0.0f; diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp index b18c0762c1a..60954503949 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp @@ -42,7 +42,7 @@ void BlurBaseOperation::initExecution() { this->inputSize = this->getInputSocketReader(1); this->data->image_in_width= this->getWidth(); this->data->image_in_height= this->getHeight(); - if(this->data->relative) { + if (this->data->relative) { switch (this->data->aspect) { case CMP_NODE_BLUR_ASPECT_NONE: this->data->sizex= (int)(this->data->percentx*0.01f*this->data->image_in_width); @@ -80,7 +80,7 @@ float* BlurBaseOperation::make_gausstab(int rad) } sum= 1.0f/sum; - for(i=0; i<n; i++) + for (i=0; i<n; i++) gausstab[i]*= sum; return gausstab; @@ -95,7 +95,7 @@ void BlurBaseOperation::deinitExecution() { this->data = NULL; } -void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers){ +void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers) { float result[4]; this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers); this->size = result[0]; diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index 31345dbaeff..1d5f4852340 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -57,7 +57,8 @@ void BokehBlurOperation::initExecution() { float dimension; if (width<height) { dimension = width; - } else { + } + else { dimension = height; } this->bokehMidX = width/2.0f; @@ -119,7 +120,8 @@ void BokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer * color[1] = tempColor[1]*(1.0/overallmultiplyerg); color[2] = tempColor[2]*(1.0/overallmultiplyerb); color[3] = 1.0f; - } else { + } + else { inputProgram->read(color, x, y, COM_PS_NEAREST, inputBuffers); } } diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp index 3286217e71d..22b73417778 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp @@ -70,9 +70,11 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y) { if (distanceRoundingToCenter>=distanceToCenter && catadioptricDistanceToCenter<=distanceToCenter) { if (distanceRoundingToCenter-distanceToCenter<1.0) { insideBokeh = (distanceRoundingToCenter-distanceToCenter); - } else if (this->data->catadioptric != 0.0 && distanceToCenter-catadioptricDistanceToCenter<1.0) { + } + else if (this->data->catadioptric != 0.0 && distanceToCenter-catadioptricDistanceToCenter<1.0) { insideBokeh = (distanceToCenter-catadioptricDistanceToCenter); - } else { + } + else { insideBokeh = 1.0; } } @@ -89,7 +91,8 @@ void BokehImageOperation::executePixel(float* color, float x, float y, PixelSamp color[0] = insideBokehMax; color[1] = insideBokehMed; color[2] = insideBokehMin; - } else { + } + else { color[0] = insideBokehMin; color[1] = insideBokehMed; color[2] = insideBokehMax; diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp index 44157051089..5b769fef3ef 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp @@ -68,7 +68,8 @@ void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler case CMP_NODE_MASKTYPE_ADD: if (inside) { color[0] = max(inputMask[0],inputValue[0]); - } else { + } + else { color[0] = inputMask[0]; } break; @@ -76,14 +77,16 @@ void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler if (inside) { color[0] = inputMask[0]-inputValue[0]; CLAMP(color[0], 0, 1); - } else { + } + else { color[0] = inputMask[0]; } break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { color[0] = inputMask[0]*inputValue[0]; - } else { + } + else { color[0] = 0; } break; @@ -91,10 +94,12 @@ void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler if (inside) { if (inputMask[0]>0.0f) { color[0] = 0; - } else { + } + else { color[0] = inputValue[0]; } - } else { + } + else { color[0] = inputMask[0]; } break; diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp index bb481f71cc1..a62470e5b1d 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp +++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp @@ -53,13 +53,11 @@ void BrightnessOperation::executePixel(float* color, float x, float y, PixelSamp * (http://visca.com/ffactory/archives/5-99/msg00021.html) * Extracted of OpenCV demhist.c */ - if( contrast > 0 ) - { + if (contrast > 0) { a = 1.0f / a; b = a * (brightness - delta); } - else - { + else { delta *= -1; b = a * (brightness + delta); } diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp index 062e7fc69fe..7a1fc5e511c 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp @@ -86,7 +86,7 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer * tile) { if (buffer[offset+3] > 0) { pixels ++; - switch(this->setting) + switch (this->setting) { case 1: { diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp index 4cd990e417e..9d9dc46eb6c 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp @@ -48,7 +48,7 @@ void* CalculateStandardDeviationOperation::initializeTileData(rcti *rect, Memory if (buffer[offset+3] > 0) { pixels ++; - switch(this->setting) + switch (this->setting) { case 1: { diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index fd2bd3991ec..da59524586c 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -42,7 +42,7 @@ void ChangeHSVOperation::executePixel(float* outputValue, float x, float y, Pixe inputOperation->read(inputColor1, x, y, sampler, inputBuffers); outputValue[0] = inputColor1[0] + (this->hue - 0.5f); - if (outputValue[0]>1.0f) outputValue[0]-=1.0; else if(outputValue[0]<0.0) outputValue[0]+= 1.0; + if (outputValue[0]>1.0f) outputValue[0]-=1.0; else if (outputValue[0]<0.0) outputValue[0]+= 1.0; outputValue[1] = inputColor1[1] * this->saturation; outputValue[2] = inputColor1[2] * this->value; outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index b595aca3c46..10ff140f8be 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -97,10 +97,10 @@ void ChannelMatteOperation::executePixel(float* outputValue, float x, float y, P alpha = 1.f - alpha; /* test range*/ - if(alpha > limit_max) { + if (alpha > limit_max) { alpha = inColor[3]; /*whatever it was prior */ } - else if(alpha < limit_min){ + else if (alpha < limit_min) { alpha = 0.f; } else {/*blend */ diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp index 8e793f08a3b..9556b673c0f 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp @@ -72,13 +72,13 @@ void ChromaMatteOperation::executePixel(float* outputValue, float x, float y, Pi /* if kfg is <0 then the pixel is outside of the key color */ kfg= x_angle-(fabsf(z_angle)/tanf(acceptance/2.f)); - if(kfg>0.f) { /* found a pixel that is within key color */ + if (kfg>0.f) { /* found a pixel that is within key color */ alpha=(1.f-kfg)*(gain); beta=atan2(z_angle,x_angle); /* if beta is within the cutoff angle */ - if(fabsf(beta) < (cutoff/2.f)) { + if (fabsf(beta) < (cutoff/2.f)) { alpha=0.f; } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp index fef045481f7..fb617549b1c 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp @@ -63,15 +63,19 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix #define MARGIN_DIV (0.5/MARGIN) if ( level < this->data->startmidtones-MARGIN) { levelShadows = 1.0f; - } else if (level < this->data->startmidtones+MARGIN) { + } + else if (level < this->data->startmidtones+MARGIN) { levelMidtones = ((level-this->data->startmidtones)*MARGIN_DIV)+0.5; levelShadows = 1.0- levelMidtones; - } else if (level < this->data->endmidtones-MARGIN) { + } + else if (level < this->data->endmidtones-MARGIN) { levelMidtones = 1.0f; - } else if (level < this->data->endmidtones+MARGIN) { + } + else if (level < this->data->endmidtones+MARGIN) { levelHighlights = ((level-this->data->endmidtones)*MARGIN_DIV)+0.5; levelMidtones = 1.0- levelHighlights; - } else { + } + else { levelHighlights = 1.0f; } #undef MARGIN @@ -111,17 +115,20 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix if (this->redChannelEnabled) { output[0] = r; - } else { + } + else { output[0] = inputImageColor[0]; } if (this->greenChannelEnabled) { output[1] = g; - } else { + } + else { output[1] = inputImageColor[1]; } if (this->blueChannelEnabled) { output[2] = b; - } else { + } + else { output[2] = inputImageColor[2]; } output[3] = inputImageColor[3]; diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index cb16b99f06b..375d7269124 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -69,9 +69,9 @@ void ColorCurveOperation::executePixel(float* color, float x, float y, PixelSamp this->inputFacProgram->read(fac, x, y, sampler, inputBuffers); this->inputImageProgram->read(image, x, y, sampler, inputBuffers); - if(fac[0]>=1.0) + if (fac[0]>=1.0) curvemapping_evaluate_premulRGBF(this->curveMapping, color, image); - else if(*fac<=0.0) { + else if (*fac<=0.0) { color[0]= image[0]; color[1]= image[1]; color[2]= image[2]; diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp index a80788ddd33..6e9c1b0d48a 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp @@ -59,7 +59,7 @@ void ColorMatteOperation::executePixel(float* outputValue, float x, float y, Pix * COM_SetAlphaOperation and the Value output */ - if( + if ( /* do hue last because it needs to wrap, and does some more checks */ /* sat */ (fabsf(inColor[1]-inKey[1]) < sat) && diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp index 9f054540332..56f45c0fdeb 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp @@ -48,7 +48,8 @@ void ColorSpillOperation::initExecution() { settings->uspillg = 0.0f; settings->uspillb = 0.0f; } - } else if (spillChannel == 1) { + } + else if (spillChannel == 1) { rmut = 1.0f; gmut = -1.0f; bmut = 1.0f; @@ -59,7 +60,8 @@ void ColorSpillOperation::initExecution() { settings->uspillg = 1.0f; settings->uspillb = 0.0f; } - } else { + } + else { rmut = 1.0f; gmut = 1.0f; bmut = -1.0f; @@ -87,7 +89,7 @@ void ColorSpillOperation::executePixel(float* outputValue, float x, float y, Pix this->inputImageReader->read(input, x, y, sampler, inputBuffers); float rfac = min(1.0f, fac[0]); map = calculateMapValue(rfac, input); - if(map>0) { + if (map>0) { outputValue[0]=input[0]+rmut*(settings->uspillr*map); outputValue[1]=input[1]+gmut*(settings->uspillg*map); outputValue[2]=input[2]+bmut*(settings->uspillb*map); diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 7590b4be299..6391fa2537d 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -56,8 +56,8 @@ void CompositorOperation::initExecution() { const Scene * scene = this->scene; Render* re= RE_GetRender(scene->id.name); RenderResult *rr= RE_AcquireResultWrite(re); - if(rr) { - if(rr->rectf != NULL) { + if (rr) { + if (rr->rectf != NULL) { MEM_freeN(rr->rectf); } rr->rectf= outputBuffer; diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp index 345fc37b340..e262533b2f7 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp @@ -37,7 +37,8 @@ float ConvertDepthToRadiusOperation::determineFocalDistance() { if (cameraObject == NULL || cameraObject->type != OB_CAMERA) { return 10.0f; - } else { + } + else { Camera *camera= (Camera*)this->cameraObject->data; cam_lens = camera->lens; if (camera->dof_ob) { diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp index 6f676b1c404..c800587ab0c 100644 --- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp @@ -40,7 +40,7 @@ void ConvertPremulToKeyOperation::executePixel(float* outputValue, float x, floa this->inputColor->read(inputValue, x, y, sampler, inputBuffers); alpha = inputValue[3]; - if(fabsf(alpha) < 1e-5f) { + if (fabsf(alpha) < 1e-5f) { outputValue[0]= 0.f; outputValue[1]= 0.f; outputValue[2]= 0.f; diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp index 623376d532f..e1aa91e35da 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp @@ -33,7 +33,7 @@ void ConvertRGBToYCCOperation::initExecution() { } void ConvertRGBToYCCOperation::setMode(int mode) { - switch(mode) + switch (mode) { case 1: this->mode = BLI_YCC_ITU_BT709; diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp index 1d8ee944915..6f9c5244c29 100644 --- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp @@ -33,7 +33,7 @@ void ConvertYCCToRGBOperation::initExecution() { } void ConvertYCCToRGBOperation::setMode(int mode) { - switch(mode) + switch (mode) { case 1: this->mode = BLI_YCC_ITU_BT709; diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp index a763ded7f52..3c4e3428ec2 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cpp +++ b/source/blender/compositor/operations/COM_CropOperation.cpp @@ -23,7 +23,7 @@ #include "COM_CropOperation.h" #include "BLI_math.h" -CropBaseOperation::CropBaseOperation() :NodeOperation(){ +CropBaseOperation::CropBaseOperation() :NodeOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; @@ -34,7 +34,7 @@ void CropBaseOperation::updateArea() { SocketReader * inputReference = this->getInputSocketReader(0); float width = inputReference->getWidth(); float height = inputReference->getHeight(); - if (this->relative){ + if (this->relative) { settings->x1= width * settings->fac_x1; settings->x2= width * settings->fac_x2; settings->y1= height * settings->fac_y1; @@ -55,22 +55,23 @@ void CropBaseOperation::updateArea() { this->ymin = MIN2(settings->y1, settings->y2); } -void CropBaseOperation::initExecution(){ +void CropBaseOperation::initExecution() { this->inputOperation = this->getInputSocketReader(0); updateArea(); } -void CropBaseOperation::deinitExecution(){ +void CropBaseOperation::deinitExecution() { this->inputOperation = NULL; } -CropOperation::CropOperation() :CropBaseOperation(){ +CropOperation::CropOperation() :CropBaseOperation() { } -void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]){ - if ((x < this->xmax && x >= xmin) && (y < ymax && y >= ymin)){ +void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { + if ((x < this->xmax && x >= xmin) && (y < ymax && y >= ymin)) { inputOperation->read(color, x, y, sampler, inputBuffers); - } else { + } + else { color[0] = 0.0f; color[1] = 0.0f; color[2] = 0.0f; @@ -78,10 +79,10 @@ void CropOperation::executePixel(float *color, float x, float y, PixelSampler sa } } -CropImageOperation::CropImageOperation() :CropBaseOperation(){ +CropImageOperation::CropImageOperation() :CropBaseOperation() { } -bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output){ +bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; newInput.xmax = input->xmax + this->xmin; @@ -92,13 +93,13 @@ bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } -void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[]){ +void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[]) { NodeOperation::determineResolution(resolution, preferedResolution); updateArea(); resolution[0] = this->xmax - this->xmin; resolution[1] = this->ymax - this->ymin; } -void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]){ +void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { this->inputOperation->read(color, (x + this->xmin), (y + this->ymin), sampler, inputBuffers); } diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp index 92d9e29dcec..c64f2593318 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp @@ -61,15 +61,15 @@ void DifferenceMatteOperation::executePixel(float* outputValue, float x, float y difference=difference/3.0; /*make 100% transparent*/ - if(difference < tolerence) { + if (difference < tolerence) { outputValue[0]=0.0; } /*in the falloff region, make partially transparent */ - else if(difference < falloff+tolerence) { + else if (difference < falloff+tolerence) { difference=difference-tolerence; alpha=difference/falloff; /*only change if more transparent than before */ - if(alpha < inColor1[3]) { + if (alpha < inColor1[3]) { outputValue[0]=alpha; } else { /* leave as before */ diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index df3bf996c96..c34d8976719 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -36,10 +36,12 @@ void DilateErodeOperation::initExecution() { this->inputProgram = this->getInputSocketReader(0); if (this->distance < 0.0f) { this->scope = - this->distance + this->inset; - } else { + } + else { if (this->inset*2 > this->distance) { this->scope = max(this->inset*2 - this->distance, this->distance); - } else { + } + else { this->scope = distance; } } @@ -87,7 +89,8 @@ void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer } } pixelvalue = -sqrtf(mindist); - } else { + } + else { for (int yi = miny ; yi<maxy;yi++) { offset = ((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4; for (int xi = minx ; xi<maxx;xi++) { @@ -109,21 +112,26 @@ void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer if (delta >= 0.0f) { if (delta >= inset) { color[0] = 1.0f; - } else { + } + else { color[0] = delta/inset; } - } else { + } + else { color[0] = 0.0f; } - } else { + } + else { const float delta = -distance+pixelvalue; if (delta < 0.0f) { if (delta < -inset) { color[0] = 1.0f; - } else { + } + else { color[0] = (-delta)/inset; } - } else { + } + else { color[0] = 0.0f; } } diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index 5b066d8f16e..4b4e9ce851a 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -73,7 +73,7 @@ void DirectionalBlurOperation::executePixel(float* color, int x, int y, MemoryBu float lsc = sc; float lrot = rot; /* blur the image */ - for(int i= 0; i < iterations; ++i) { + for (int i= 0; i < iterations; ++i) { const float cs= cos(lrot), ss= sin(lrot); const float isc= 1.f / (1.f + lsc); diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp index bef470ca9de..ab4df7bf1ac 100644 --- a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp @@ -63,15 +63,15 @@ void DistanceMatteOperation::executePixel(float* outputValue, float x, float y, */ /*make 100% transparent */ - if(distance < tolerence) { + if (distance < tolerence) { outputValue[0]=0.f; } /*in the falloff region, make partially transparent */ - else if(distance < falloff+tolerence){ + else if (distance < falloff+tolerence) { distance=distance-tolerence; alpha=distance/falloff; /*only change if more transparent than before */ - if(alpha < inImage[3]) { + if (alpha < inImage[3]) { outputValue[0]=alpha; } else { /* leave as before */ diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index cb6b27b9da1..b42e676893a 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -26,7 +26,7 @@ // this part has been copied from the double edge mask // Contributor(s): Peter Larabell. -static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -35,134 +35,150 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int /* upper left corner */ x=t-rw+1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel underneath, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])){ + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + else { + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge + } + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* upper right corner */ x=t; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel underneath, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])){ + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* lower left corner */ x=0; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel above, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])){ + if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* lower right corner */ x=rw-1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel above, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])){ + if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* Test the TOP row of pixels in buffer, except corners */ - for(x= t-1; x>=(t-rw)+2; x--) { + for (x= t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel to the right, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the BOTTOM row of pixels in buffer, except corners */ - for(x= rw-2; x; x--) { + for (x= rw-2; x; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel to the right, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the LEFT edge of pixels in buffer, except corners */ - for(x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x= t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the RIGHT edge of pixels in buffer, except corners */ - for(x= t-rw; x>rw; x-=rw) { + for (x= t-rw; x>rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } @@ -173,7 +189,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int rsize[2]=gsz; } -static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -182,20 +198,23 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in /* upper left corner */ x=t-rw+1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel underneath, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])){ + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -203,20 +222,23 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in /* upper right corner */ x=t; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel underneath, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])){ + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -224,20 +246,23 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in /* lower left corner */ x=0; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel above, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])){ + if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty above or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty above or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -245,41 +270,47 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in /* lower right corner */ x=rw-1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel above, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])){ + if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } } /* Test the TOP row of pixels in buffer, except corners */ - for(x= t-1; x>=(t-rw)+2; x--) { + for (x= t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel to the left, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -287,44 +318,50 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } /* Test the BOTTOM row of pixels in buffer, except corners */ - for(x= rw-2; x; x--) { + for (x= rw-2; x; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel to the left, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } } } /* Test the LEFT edge of pixels in buffer, except corners */ - for(x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x= t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -332,22 +369,25 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } /* Test the RIGHT edge of pixels in buffer, except corners */ - for(x= t-rw; x>rw; x-=rw) { + for (x= t-rw; x>rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -359,7 +399,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in rsize[2]=gsz; } -static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -368,126 +408,142 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim /* upper left corner */ x=t-rw+1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if the inner mask is empty underneath or to the right - if(!limask[x-rw] || !limask[x+1]){ + if (!limask[x-rw] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* upper right corner */ x=t; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if the inner mask is empty underneath or to the left - if(!limask[x-rw] || !limask[x-1]){ + if (!limask[x-rw] || !limask[x-1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* lower left corner */ x=0; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if inner mask is empty above or to the right - if(!limask[x+rw] || !limask[x+1]){ + if (!limask[x+rw] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* lower right corner */ x=rw-1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if inner mask is empty above or to the left - if(!limask[x+rw] || !limask[x-1]){ + if (!limask[x+rw] || !limask[x-1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* Test the TOP row of pixels in buffer, except corners */ - for(x= t-1; x>=(t-rw)+2; x--) { + for (x= t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty to the left or to the right - if(!limask[x-1] || !limask[x+1]) { + if (!limask[x-1] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the BOTTOM row of pixels in buffer, except corners */ - for(x= rw-2; x; x--) { + for (x= rw-2; x; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty to the left or to the right - if(!limask[x-1] || !limask[x+1]) { + if (!limask[x-1] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the LEFT edge of pixels in buffer, except corners */ - for(x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x= t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty underneath or above - if(!limask[x-rw] || !limask[x+rw]) { + if (!limask[x-rw] || !limask[x+rw]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the RIGHT edge of pixels in buffer, except corners */ - for(x= t-rw; x>rw; x-=rw) { + for (x= t-rw; x>rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty underneath or above - if(!limask[x-rw] || !limask[x+rw]) { + if (!limask[x-rw] || !limask[x+rw]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } @@ -498,7 +554,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim rsize[2]=gsz; } -static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -507,19 +563,22 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li /* upper left corner */ x=t-rw+1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if the inner mask is empty underneath or to the right - if(!limask[x-rw] || !limask[x+1]){ + if (!limask[x-rw] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -527,19 +586,22 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li /* upper right corner */ x=t; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if the inner mask is empty underneath or to the left - if(!limask[x-rw] || !limask[x-1]){ + if (!limask[x-rw] || !limask[x-1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -547,19 +609,22 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li /* lower left corner */ x=0; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if inner mask is empty above or to the right - if(!limask[x+rw] || !limask[x+1]){ + if (!limask[x+rw] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -567,39 +632,45 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li /* lower right corner */ x=rw-1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if inner mask is empty above or to the left - if(!limask[x+rw] || !limask[x-1]){ + if (!limask[x+rw] || !limask[x-1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } } /* Test the TOP row of pixels in buffer, except corners */ - for(x= t-1; x>=(t-rw)+2; x--) { + for (x= t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty to the left or to the right - if(!limask[x-1] || !limask[x+1]) { + if (!limask[x-1] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -607,42 +678,48 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } /* Test the BOTTOM row of pixels in buffer, except corners */ - for(x= rw-2; x; x--) { + for (x= rw-2; x; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty to the left or to the right - if(!limask[x-1] || !limask[x+1]) { + if (!limask[x-1] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } } } /* Test the LEFT edge of pixels in buffer, except corners */ - for(x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x= t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty underneath or above - if(!limask[x-rw] || !limask[x+rw]) { + if (!limask[x-rw] || !limask[x+rw]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -650,21 +727,24 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } /* Test the RIGHT edge of pixels in buffer, except corners */ - for(x= t-rw; x>rw; x-=rw) { + for (x= t-rw; x>rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty underneath or above - if(!limask[x-rw] || !limask[x+rw]) { + if (!limask[x-rw] || !limask[x+rw]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -676,7 +756,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li rsize[2]=gsz; } -static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz){ +static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) { int x; // x = pixel loop counter int a; // a = pixel loop counter int dx; // dx = delta x @@ -685,39 +765,42 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop /* Test all rows between the FIRST and LAST rows, excluding left and right edges */ - for(x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { + for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { a=x-2; pix_prevRow=a+rw; pix_nextRow=a-rw; pix_prevCol=a+1; pix_nextCol=a-1; - while(a>dx-2) { - if(!limask[a]) { // if the inner mask is empty - if(lomask[a]) { // if the outer mask is full + while (a>dx-2) { + if (!limask[a]) { // if the inner mask is empty + if (lomask[a]) { // if the outer mask is full /* Next we test all 4 directions around the current pixel: next/prev/up/down The test ensures that the outer mask is empty and that the inner mask is also empty. If both conditions are true for any one of the 4 adjacent pixels then the current pixel is counted as being a true outer edge pixel. */ - if((!lomask[pix_nextCol] && !limask[pix_nextCol]) || + if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) || (!lomask[pix_prevCol] && !limask[pix_prevCol]) || (!lomask[pix_nextRow] && !limask[pix_nextRow]) || (!lomask[pix_prevRow] && !limask[pix_prevRow])) { in_osz++; // increment the outer boundary pixel count lres[a]=3; // flag pixel as part of outer edge - } else { // it's not a boundary pixel, but it is a gradient pixel + } + else { // it's not a boundary pixel, but it is a gradient pixel in_gsz++; // increment the gradient pixel count lres[a]=2; // flag pixel as gradient } } - } else { - if(!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) { + } + else { + if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) { in_isz++; // increment the inner boundary pixel count lres[a]=4; // flag pixel as part of inner edge - } else { + } + else { res[a]=1.0f; // pixel is part of inner mask, but not at an edge } } @@ -734,7 +817,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l rsize[2]=in_gsz; } -static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz){ +static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) { int x; // x = pixel loop counter int a; // a = pixel loop counter int dx; // dx = delta x @@ -743,43 +826,46 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop /* Test all rows between the FIRST and LAST rows, excluding left and right edges */ - for(x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { + for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { a=x-2; pix_prevRow=a+rw; pix_nextRow=a-rw; pix_prevCol=a+1; pix_nextCol=a-1; - while(a>dx-2) { - if(!limask[a]) { // if the inner mask is empty - if(lomask[a]) { // if the outer mask is full + while (a>dx-2) { + if (!limask[a]) { // if the inner mask is empty + if (lomask[a]) { // if the outer mask is full /* Next we test all 4 directions around the current pixel: next/prev/up/down The test ensures that the outer mask is empty and that the inner mask is also empty. If both conditions are true for any one of the 4 adjacent pixels then the current pixel is counted as being a true outer edge pixel. */ - if((!lomask[pix_nextCol] && !limask[pix_nextCol]) || + if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) || (!lomask[pix_prevCol] && !limask[pix_prevCol]) || (!lomask[pix_nextRow] && !limask[pix_nextRow]) || (!lomask[pix_prevRow] && !limask[pix_prevRow])) { in_osz++; // increment the outer boundary pixel count lres[a]=3; // flag pixel as part of outer edge - } else { // it's not a boundary pixel, but it is a gradient pixel + } + else { // it's not a boundary pixel, but it is a gradient pixel in_gsz++; // increment the gradient pixel count lres[a]=2; // flag pixel as gradient } } - } else { - if((!limask[pix_nextCol] && lomask[pix_nextCol]) || + } + else { + if ((!limask[pix_nextCol] && lomask[pix_nextCol]) || (!limask[pix_prevCol] && lomask[pix_prevCol]) || (!limask[pix_nextRow] && lomask[pix_nextRow]) || (!limask[pix_prevRow] && lomask[pix_prevRow])) { in_isz++; // increment the inner boundary pixel count lres[a]=4; // flag pixel as part of inner edge - } else { + } + else { res[a]=1.0f; // pixel is part of inner mask, but not at an edge } } @@ -796,7 +882,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i rsize[2]=in_gsz; } -static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz){ +static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz) { int x; // x = pixel loop counter int a; // a = temporary pixel index buffer loop counter unsigned int ud; // ud = unscaled edge distance @@ -878,21 +964,23 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne innerAccum = *innerEdgeOffset; // section's offset so when we start filling, each outerAccum = *outerEdgeOffset; // section fills up it's allocated space in gbuf //uses dmin=row, rsl=col - for(x=0,dmin=0; x<t; x+=rw,dmin++) { - for(rsl=0; rsl<rw; rsl++) { + for (x=0,dmin=0; x<t; x+=rw,dmin++) { + for (rsl=0; rsl<rw; rsl++) { a=x+rsl; - if(lres[a]==2) { // it is a gradient pixel flagged by 2 + if (lres[a]==2) { // it is a gradient pixel flagged by 2 ud=gradientAccum<<1; // double the index to reach correct unsigned short location gbuf[ud]=dmin; // insert pixel's row into gradient pixel location buffer gbuf[ud+1]=rsl; // insert pixel's column into gradient pixel location buffer gradientAccum++; // increment gradient index buffer pointer - } else if(lres[a]==3) { // it is an outer edge pixel flagged by 3 + } + else if (lres[a]==3) { // it is an outer edge pixel flagged by 3 ud=outerAccum<<1; // double the index to reach correct unsigned short location gbuf[ud]=dmin; // insert pixel's row into outer edge pixel location buffer gbuf[ud+1]=rsl; // insert pixel's column into outer edge pixel location buffer outerAccum++; // increment outer edge index buffer pointer res[a]=0.0f; // set output pixel intensity now since it won't change later - } else if(lres[a]==4) { // it is an inner edge pixel flagged by 4 + } + else if (lres[a]==4) { // it is an inner edge pixel flagged by 4 ud=innerAccum<<1; // double int index to reach correct unsigned short location gbuf[ud]=dmin; // insert pixel's row into inner edge pixel location buffer gbuf[ud+1]=rsl; // insert pixel's column into inner edge pixel location buffer @@ -904,7 +992,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne } -static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset){ +static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset) { int x; // x = pixel loop counter int a; // a = temporary pixel index buffer loop counter int fsz; // size of the frame @@ -980,17 +1068,17 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g Loop through all gradient pixels. */ - for(x= gsz-1; x>=0; x--) { + for (x= gsz-1; x>=0; x--) { gradientFillOffset=x<<1; t=gbuf[gradientFillOffset]; // calculate column of pixel indexed by gbuf[x] fsz=gbuf[gradientFillOffset+1]; // calculate row of pixel indexed by gbuf[x] dmin=0xffffffff; // reset min distance to edge pixel - for(a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) { // loop through all outer edge buffer pixels + for (a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) { // loop through all outer edge buffer pixels ud=a<<1; dy=t-gbuf[ud]; // set dx to gradient pixel column - outer edge pixel row dx=fsz-gbuf[ud+1]; // set dy to gradient pixel row - outer edge pixel column ud=dx*dx+dy*dy; // compute sum of squares - if(ud<dmin) { // if our new sum of squares is less than the current minimum + if (ud<dmin) { // if our new sum of squares is less than the current minimum dmin=ud; // set a new minimum equal to the new lower value } } @@ -1001,12 +1089,12 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g odist=*(float*)&rsl; // reciprocal square root odist=odist*(rsopf-(rsf*odist*odist)); // -- ** this line can be iterated for more accuracy ** -- dmin=0xffffffff; // reset min distance to edge pixel - for(a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels + for (a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels ud=a<<1; dy=t-gbuf[ud]; // compute delta in Y from gradient pixel to inside edge pixel dx=fsz-gbuf[ud+1]; // compute delta in X from gradient pixel to inside edge pixel ud=dx*dx+dy*dy; // compute sum of squares - if(ud<dmin) { // if our new sum of squares is less than the current minimum we've found + if (ud<dmin) { // if our new sum of squares is less than the current minimum we've found dmin=ud; // set a new minimum equal to the new lower value } } @@ -1052,7 +1140,7 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float unsigned short *gbuf; // gradient/inner/outer pixel location index buffer - if(true) { // if both input sockets have some data coming in... + if (true) { // if both input sockets have some data coming in... t=(this->getWidth()*this->getHeight())-1; // determine size of the frame @@ -1087,10 +1175,11 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float Each version has slightly different criteria for detecting an edge pixel. */ - if(this->adjecentOnly) { // if "adjacent only" inner edge mode is turned on - if(this->keepInside) { // if "keep inside" buffer edge mode is turned on + if (this->adjecentOnly) { // if "adjacent only" inner edge mode is turned on + if (this->keepInside) { // if "keep inside" buffer edge mode is turned on do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize); - }else{ // "bleed out" buffer edge mode is turned on + } + else { // "bleed out" buffer edge mode is turned on do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize); } isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass @@ -1098,10 +1187,12 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float gsz=rsize[2]; // detect edges in all non-border pixels in the buffer do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz); - }else{ // "all" inner edge mode is turned on - if(this->keepInside) { // if "keep inside" buffer edge mode is turned on + } + else { // "all" inner edge mode is turned on + if (this->keepInside) { // if "keep inside" buffer edge mode is turned on do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize); - }else{ // "bleed out" buffer edge mode is turned on + } + else { // "bleed out" buffer edge mode is turned on do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize); } isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass @@ -1144,7 +1235,8 @@ bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti *input, Read newInput.ymax = this->getHeight(); newInput.ymin = 0; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); - } else { + } + else { return false; } } diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index 033cb4da84d..bc15523c149 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -72,7 +72,8 @@ void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSam case CMP_NODE_MASKTYPE_ADD: if (inside) { color[0] = max(inputMask[0],inputValue[0]); - } else { + } + else { color[0] = inputMask[0]; } break; @@ -80,14 +81,16 @@ void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSam if (inside) { color[0] = inputMask[0]-inputValue[0]; CLAMP(color[0], 0, 1); - } else { + } + else { color[0] = inputMask[0]; } break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { color[0] = inputMask[0]*inputValue[0]; - } else { + } + else { color[0] = 0; } break; @@ -95,10 +98,12 @@ void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSam if (inside) { if (inputMask[0]>0.0f) { color[0] = 0; - } else { + } + else { color[0] = inputValue[0]; } - } else { + } + else { color[0] = inputMask[0]; } break; diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index aae39694220..6194e1d6699 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -24,7 +24,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation(){ +FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation() { this->iirgaus = false; } @@ -34,7 +34,7 @@ void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBu newData->read(color, x, y); } -bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output){ +bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; rcti sizeInput; sizeInput.xmin = 0; @@ -45,13 +45,15 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re NodeOperation * operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; - }else { - if(this->iirgaus){ + } + else { + if (this->iirgaus) { newInput.xmax = input->xmax + (sx); newInput.xmin = input->xmin - (sx); newInput.ymax = input->ymax + (sy); newInput.ymin = input->ymin - (sy); - }else { + } + else { newInput.xmin = 0; newInput.ymin = 0; newInput.xmax = this->getWidth(); @@ -61,7 +63,7 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re } } -void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers){ +void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers); MemoryBuffer *copy = newBuf->duplicate(); updateSize(memoryBuffers); @@ -88,7 +90,7 @@ void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **m return copy; } -void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data){ +void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) { MemoryBuffer *newData = (MemoryBuffer*)data; delete newData; } diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp index afe3173ab0f..98acb4cfb5d 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cpp +++ b/source/blender/compositor/operations/COM_FlipOperation.cpp @@ -52,14 +52,16 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper if (this->flipX) { newInput.xmax = (this->getWidth()- 1 - input->xmin)+1; newInput.xmin = (this->getWidth()- 1 - input->xmax)-1; - } else { + } + else { newInput.xmin = input->xmin; newInput.xmax = input->xmax; } if (this->flipY) { newInput.ymax = (this->getHeight()- 1 - input->ymin)+1; newInput.ymin = (this->getHeight()- 1 - input->ymax)-1; - } else { + } + else { newInput.ymin = input->ymin; newInput.ymax = input->ymax; } diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index 9b7df61143e..faadad27a55 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -51,16 +51,16 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { updateSize(memoryBuffers); radxf = size*(float)this->data->sizex; - if(radxf>width/2.0f) + if (radxf>width/2.0f) radxf= width/2.0f; - else if(radxf<1.0f) + else if (radxf<1.0f) radxf= 1.0f; /* vertical */ radyf = size*(float)this->data->sizey; - if(radyf>height/2.0f) + if (radyf>height/2.0f) radyf= height/2.0f; - else if(radyf<1.0f) + else if (radyf<1.0f) radyf= 1.0f; radx= ceil(radxf); @@ -72,8 +72,8 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { ddgauss= new float[n]; dgauss= ddgauss; val= 0.0f; - for(j=-rady; j<=rady; j++) { - for(i=-radx; i<=radx; i++, dgauss++) { + for (j=-rady; j<=rady; j++) { + for (i=-radx; i<=radx; i++, dgauss++) { float fj= (float)j/radyf; float fi= (float)i/radxf; float dist= sqrt(fj*fj + fi*fi); @@ -82,9 +82,9 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { val+= *dgauss; } } - if(val!=0.0f) { + if (val!=0.0f) { val= 1.0f/val; - for(j= n -1; j>=0; j--) + for (j= n -1; j>=0; j--) ddgauss[j]*= val; } else ddgauss[4]= 1.0f; @@ -155,7 +155,8 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; - } else { + } + else { if (this->gausstab) { int addx = radx; int addy = rady; @@ -163,7 +164,8 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R newInput.xmin = input->xmin - addx; newInput.ymax = input->ymax + addy; newInput.ymin = input->ymin - addy; - } else { + } + else { newInput.xmin = 0; newInput.ymin = 0; newInput.xmax = this->getWidth(); diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index a93c0e44d18..7ac8fcb2d64 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -43,7 +43,7 @@ void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { if (this->gausstab == NULL) { updateSize(memoryBuffers); float rad = size*this->data->sizex; - if(rad<1) + if (rad<1) rad= 1; this->rad = rad; @@ -111,13 +111,15 @@ bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB NodeOperation * operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; - }else { + } + else { if (this->gausstab == NULL) { newInput.xmax = this->getWidth(); newInput.xmin = 0; newInput.ymax = this->getHeight(); newInput.ymin = 0; - }else{ + } + else { newInput.xmax = input->xmax + rad; newInput.xmin = input->xmin - rad; newInput.ymax = input->ymax; diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index 86f9dbf5c40..2218334bec8 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -42,7 +42,7 @@ void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { if (this->gausstab == NULL) { updateSize(memoryBuffers); float rad = size*this->data->sizey; - if(rad<1) + if (rad<1) rad= 1; this->rad = rad; @@ -108,13 +108,15 @@ bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB NodeOperation * operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; - }else { + } + else { if (this->gausstab == NULL) { newInput.xmax = this->getWidth(); newInput.xmin = 0; newInput.ymax = this->getHeight(); newInput.ymin = 0; - } else { + } + else { newInput.xmax = input->xmax; newInput.xmin = input->xmin; newInput.ymax = input->ymax + rad; diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp index 52c2e44f7d4..f4cea24cb20 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cpp +++ b/source/blender/compositor/operations/COM_ImageOperation.cpp @@ -61,7 +61,7 @@ ImBuf* BaseImageOperation::getImBuf() { ImBuf *ibuf; ibuf= BKE_image_get_ibuf(this->image, this->imageUser); - if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { + if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { return NULL; } @@ -102,7 +102,8 @@ void ImageOperation::executePixel(float *color, float x, float y, PixelSampler s color[1] = 0.0f; color[2] = 0.0f; color[3] = 0.0f; - } else { + } + else { switch (sampler) { case COM_PS_NEAREST: neareast_interpolation_color(this->buffer, NULL, color, x, y); @@ -122,7 +123,8 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp if (this->imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) { color[0] = 0.0f; - } else { + } + else { tempcolor[3] = 1.0f; switch (sampler) { case COM_PS_NEAREST: @@ -142,7 +144,8 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { if (this->depthBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) { color[0] = 0.0f; - } else { + } + else { int offset = y * width + x; color[0] = this->depthBuffer[offset]; } diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp index a90c7b6b8d2..baf8699603c 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cpp +++ b/source/blender/compositor/operations/COM_InvertOperation.cpp @@ -46,17 +46,18 @@ void InvertOperation::executePixel(float* out, float x, float y, PixelSampler sa const float value = inputValue[0]; const float invertedValue = 1.0f - value; - if(color) { + if (color) { out[0] = (1.0f - inputColor[0])*value + inputColor[0]*invertedValue; out[1] = (1.0f - inputColor[1])*value + inputColor[1]*invertedValue; out[2] = (1.0f - inputColor[2])*value + inputColor[2]*invertedValue; - } else { + } + else { out[0] = inputColor[0]; out[1] = inputColor[1]; out[2] = inputColor[2]; } - if(alpha) + if (alpha) out[3] = (1.0f - inputColor[3])*value + inputColor[3]*invertedValue; else out[3] = inputColor[3]; diff --git a/source/blender/compositor/operations/COM_LensGhostOperation.cpp b/source/blender/compositor/operations/COM_LensGhostOperation.cpp index 6236708c9e1..89387675090 100644 --- a/source/blender/compositor/operations/COM_LensGhostOperation.cpp +++ b/source/blender/compositor/operations/COM_LensGhostOperation.cpp @@ -119,7 +119,8 @@ public: float b2c = b*b-c; if (b2c < 0) { result->hit = false; - } else { + } + else { float sgn = (this->radius*ray->direction[2])>0?1.0f:-1.0f; float t = sqrtf(b2c)*sgn-b; result->position[0] = ray->direction[0]*t+ray->position[0]; @@ -137,7 +138,8 @@ public: result->normal[0] = -p[0]; result->normal[1] = -p[1]; result->normal[2] = -p[2]; - } else { + } + else { result->normal[0] = p[0]; result->normal[1] = p[1]; result->normal[2] = p[2]; @@ -168,7 +170,7 @@ public: bool valid; bool hasIntensity; }; -class Bounce{ +class Bounce { public: LensInterface *interface1; LensInterface *interface2; @@ -245,15 +247,15 @@ public: // dot= view[0]*n[0] + view[1]*n[1] + view[2]*n[2]; -// if(dot>0.0f) { +// if (dot>0.0f) { // index = 1.0f/index; // fac= 1.0f - (1.0f - dot*dot)*index*index; -// if(fac<= 0.0f) return 0; +// if (fac<= 0.0f) return 0; // fac= -dot*index + sqrt(fac); // } // else { // fac= 1.0f - (1.0f - dot*dot)*index*index; -// if(fac<= 0.0f) return 0; +// if (fac<= 0.0f) return 0; // fac= -dot*index - sqrt(fac); // } @@ -281,7 +283,8 @@ public: // double test = 1.0f - index*index*(1.0f-ni*ni); // if (test < 0) { // return 0; -// } else { +// } +// else { // double mul = index*ni + sqrt(test); // refract[0] = index * view[0] - mul*n[0]; // refract[1] = index * view[1] - mul*n[1]; @@ -348,7 +351,8 @@ public: delta = -delta; if (phase == 0) { next = bounce->interface2; - } else { + } + else { next = NULL; } phase ++; @@ -399,7 +403,8 @@ public: if (ref == 0) { break; } - } else { + } + else { this->reflection(result->direction, intersection.normal, result->direction); float fresnelMultiplyer = fresnelAR(intersection.theta, result->wavelength, f->thicknessCoathing, n0, n1, n2); if (isnan(fresnelMultiplyer)) { @@ -412,7 +417,8 @@ public: } if (k < bounce->length-1) { result->intensity = 0; - } else { + } + else { result->valid = true; } } @@ -446,7 +452,8 @@ void LensGhostProjectionOperation::initExecution() { visualLampPosition[0] = 0; visualLampPosition[1] = 0; visualLampPosition[2] = 0; - } else { + } + else { /* too simple, better to return the distance on the view axis only * return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */ float matt[4][4], imat[4][4], obmat[4][4]; @@ -612,21 +619,25 @@ void* LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu face->v2 = vertex4; face->v3 = vertex1; result->push_back(face); - } else if (number == 3) { + } + else if (number == 3) { LensFace *face = new LensFace(); if (!vertex1->hasIntensity) { face->v1 = vertex2; face->v2 = vertex3; face->v3 = vertex4; - } else if (!vertex2->hasIntensity) { + } + else if (!vertex2->hasIntensity) { face->v1 = vertex1; face->v2 = vertex3; face->v3 = vertex4; - } else if (!vertex3->hasIntensity) { + } + else if (!vertex3->hasIntensity) { face->v1 = vertex1; face->v2 = vertex2; face->v3 = vertex4; - } else { + } + else { face->v1 = vertex1; face->v2 = vertex2; face->v3 = vertex3; diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp index 7850a631212..3e8a5ed3344 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp @@ -52,10 +52,10 @@ void LuminanceMatteOperation::executePixel(float* outputValue, float x, float y, */ /* test range*/ - if(inColor[0] > high) { + if (inColor[0] > high) { alpha=1.f; } - else if(inColor[0] < low){ + else if (inColor[0] < low) { alpha=0.f; } else {/*blend */ diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index ef0c9004a7d..08790955d03 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -110,7 +110,7 @@ void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler s this->inputColorProgram->read(color, u, v, dx, dy, inputBuffers); /* "premul" */ - if(alpha < 1.0f) { + if (alpha < 1.0f) { color[0]*= alpha; color[1]*= alpha; color[2]*= alpha; diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp index 33d38b8475d..5a7005af382 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp @@ -37,11 +37,11 @@ void MapValueOperation::executePixel(float* outputValue, float x, float y, Pixel inputOperation->read(src, x, y, sampler, inputBuffers); TexMapping *texmap= this->settings; float value = (src[0] + texmap->loc[0])*texmap->size[0]; - if(texmap->flag & TEXMAP_CLIP_MIN) - if(value<texmap->min[0]) + if (texmap->flag & TEXMAP_CLIP_MIN) + if (value<texmap->min[0]) value= texmap->min[0]; - if(texmap->flag & TEXMAP_CLIP_MAX) - if(value>texmap->max[0]) + if (texmap->flag & TEXMAP_CLIP_MAX) + if (value>texmap->max[0]) value= texmap->max[0]; outputValue[0] = value; diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index 55880566bf2..d612361a7fe 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -81,7 +81,7 @@ void MathDivideOperation::executePixel(float* outputValue, float x, float y, Pix inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if(inputValue2[0]==0) /* We don't want to divide by zero. */ + if (inputValue2[0]==0) /* We don't want to divide by zero. */ outputValue[0]= 0.0; else outputValue[0]= inputValue1[0] / inputValue2[0]; @@ -124,7 +124,7 @@ void MathArcSineOperation::executePixel(float* outputValue, float x, float y, Pi inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if(inputValue1[0] <= 1 && inputValue1[0] >= -1 ) + if (inputValue1[0] <= 1 && inputValue1[0] >= -1 ) outputValue[0]= asin(inputValue1[0]); else outputValue[0]= 0.0; @@ -137,7 +137,7 @@ void MathArcCosineOperation::executePixel(float* outputValue, float x, float y, inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if(inputValue1[0] <= 1 && inputValue1[0] >= -1 ) + if (inputValue1[0] <= 1 && inputValue1[0] >= -1 ) outputValue[0]= acos(inputValue1[0]); else outputValue[0]= 0.0; @@ -160,14 +160,16 @@ void MathPowerOperation::executePixel(float* outputValue, float x, float y, Pixe inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if( inputValue1[0] >= 0 ) { + if ( inputValue1[0] >= 0 ) { outputValue[0]= pow(inputValue1[0], inputValue2[0]); - } else { + } + else { float y_mod_1 = fmod(inputValue2[0], 1); /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */ if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { outputValue[0]= pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5)); - } else { + } + else { outputValue[0] = 0.0; } } @@ -180,7 +182,7 @@ void MathLogarithmOperation::executePixel(float* outputValue, float x, float y, inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if( inputValue1[0] > 0 && inputValue2[0] > 0 ) + if ( inputValue1[0] > 0 && inputValue2[0] > 0 ) outputValue[0]= log(inputValue1[0]) / log(inputValue2[0]); else outputValue[0]= 0.0; diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp index 9f8378defe9..a84ecc6edf8 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp @@ -64,23 +64,25 @@ void MixBaseOperation::deinitExecution() { this->inputColor2Operation = NULL; } -void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]){ +void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { InputSocket* socket; unsigned int tempPreferredResolution[] = {0,0}; unsigned int tempResolution[2]; socket = this->getInputSocket(1); socket->determineResolution(tempResolution, tempPreferredResolution); - if((tempResolution[0] != 0) && (tempResolution[1] != 0)){ + if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { this->setResolutionInputSocketIndex(1); - }else { + } + else { socket = this->getInputSocket(2); tempPreferredResolution[0] = 0; tempPreferredResolution[1] = 0; socket->determineResolution(tempResolution, tempPreferredResolution); - if((tempResolution[0] != 0) && (tempResolution[1] != 0)){ + if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { this->setResolutionInputSocketIndex(2); - }else { + } + else { this->setResolutionInputSocketIndex(0); } } diff --git a/source/blender/compositor/operations/COM_MixColorOperation.cpp b/source/blender/compositor/operations/COM_MixColorOperation.cpp index ebcb7056570..d5ec55daf07 100644 --- a/source/blender/compositor/operations/COM_MixColorOperation.cpp +++ b/source/blender/compositor/operations/COM_MixColorOperation.cpp @@ -45,7 +45,7 @@ void MixColorOperation::executePixel(float* outputValue, float x, float y, Pixel float colH,colS,colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); - if(colS!=0.0f){ + if (colS!=0.0f) { float rH,rS,rV; float tmpr,tmpg,tmpb; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp index 773a51e92cb..7e8271a9c96 100644 --- a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp @@ -40,13 +40,13 @@ void MixDarkenOperation::executePixel(float* outputValue, float x, float y, Pixe float valuem = 1.0f-value; float tmp; tmp=inputColor2[0]+((1.0f-inputColor2[0])*valuem); - if(tmp < inputColor1[0]) outputValue[0]= tmp; + if (tmp < inputColor1[0]) outputValue[0]= tmp; else outputValue[0] = inputColor1[0]; tmp=inputColor2[1]+((1.0f-inputColor2[1])*valuem); - if(tmp < inputColor1[1]) outputValue[1]= tmp; + if (tmp < inputColor1[1]) outputValue[1]= tmp; else outputValue[1] = inputColor1[1]; tmp=inputColor2[2]+((1.0f-inputColor2[2])*valuem); - if(tmp < inputColor1[2]) outputValue[2]= tmp; + if (tmp < inputColor1[2]) outputValue[2]= tmp; else outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.cpp b/source/blender/compositor/operations/COM_MixDivideOperation.cpp index c2579c6a89c..6bab381c706 100644 --- a/source/blender/compositor/operations/COM_MixDivideOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDivideOperation.cpp @@ -39,15 +39,15 @@ void MixDivideOperation::executePixel(float* outputValue, float x, float y, Pixe } float valuem= 1.0f-value; - if(inputColor2[0]!=0.0f) + if (inputColor2[0]!=0.0f) outputValue[0] = valuem*(inputColor1[0]) + value*(inputColor1[0])/inputColor2[0]; else outputValue[0] = 0.0f; - if(inputColor2[1]!=0.0f) + if (inputColor2[1]!=0.0f) outputValue[1] = valuem*(inputColor1[1]) + value*(inputColor1[1])/inputColor2[1]; else outputValue[1] = 0.0f; - if(inputColor2[2]!=0.0f) + if (inputColor2[2]!=0.0f) outputValue[2] = valuem*(inputColor1[2]) + value*(inputColor1[2])/inputColor2[2]; else outputValue[2] = 0.0f; diff --git a/source/blender/compositor/operations/COM_MixHueOperation.cpp b/source/blender/compositor/operations/COM_MixHueOperation.cpp index 386bd02ba2a..8454c694f65 100644 --- a/source/blender/compositor/operations/COM_MixHueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixHueOperation.cpp @@ -45,7 +45,7 @@ void MixHueOperation::executePixel(float* outputValue, float x, float y, PixelSa float colH,colS,colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); - if(colS!=0.0f){ + if (colS!=0.0f) { float rH,rS,rV; float tmpr,tmpg,tmpb; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.cpp b/source/blender/compositor/operations/COM_MixLightenOperation.cpp index 32d28b785b7..6a06d5ab6e1 100644 --- a/source/blender/compositor/operations/COM_MixLightenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLightenOperation.cpp @@ -39,13 +39,13 @@ void MixLightenOperation::executePixel(float* outputValue, float x, float y, Pix } float tmp; tmp=value * inputColor2[0]; - if(tmp > inputColor1[0]) outputValue[0]= tmp; + if (tmp > inputColor1[0]) outputValue[0]= tmp; else outputValue[0] = inputColor1[0]; tmp=value * inputColor2[1]; - if(tmp > inputColor1[1]) outputValue[1]= tmp; + if (tmp > inputColor1[1]) outputValue[1]= tmp; else outputValue[1] = inputColor1[1]; tmp=value * inputColor2[2]; - if(tmp > inputColor1[2]) outputValue[2]= tmp; + if (tmp > inputColor1[2]) outputValue[2]= tmp; else outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp index 8254701adad..7a3030b9262 100644 --- a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp @@ -40,19 +40,22 @@ void MixOverlayOperation::executePixel(float* outputValue, float x, float y, Pix float valuem= 1.0f-value; - if(inputColor1[0] < 0.5f) { + if (inputColor1[0] < 0.5f) { outputValue[0] = inputColor1[0] * (valuem + 2.0f*value*inputColor2[0]); - } else { + } + else { outputValue[0] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[0])) * (1.0f - inputColor1[0]); } - if(inputColor1[1] < 0.5f) { + if (inputColor1[1] < 0.5f) { outputValue[1] = inputColor1[1] * (valuem + 2.0f*value*inputColor2[1]); - } else { + } + else { outputValue[1] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[1])) * (1.0f - inputColor1[1]); } - if(inputColor1[2] < 0.5f) { + if (inputColor1[2] < 0.5f) { outputValue[2] = inputColor1[2] * (valuem + 2.0f*value*inputColor2[2]); - } else { + } + else { outputValue[2] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[2])) * (1.0f - inputColor1[2]); } outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp index 18ff6f46c46..a8fe647828b 100644 --- a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp @@ -45,7 +45,7 @@ void MixSaturationOperation::executePixel(float* outputValue, float x, float y, float rH,rS,rV; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); - if(rS!=0.0f){ + if (rS!=0.0f) { float colH,colS,colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); hsv_to_rgb(rH , (valuem*rS+value*colS), rV, &outputValue[0], &outputValue[1], &outputValue[2]); diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp index 74179293c6c..7597497acc7 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp @@ -78,7 +78,8 @@ void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampl color[1] = 0.0f; color[2] = 0.0f; color[3] = 0.0f; - } else { + } + else { switch (sampler) { case COM_PS_NEAREST: neareast_interpolation_color(this->movieClipBuffer, NULL, color, x, y); diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index 360719aa59f..b848192d40b 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -54,7 +54,8 @@ void MovieDistortionOperation::initExecution() { DistortionCache* newC = new DistortionCache(this->movieClip, this->width, this->height, this->distortion); s_cache.push_back(newC); this->cache = newC; - } else { + } + else { this->cache = NULL; } } diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp index 53b71ed528e..df2b762b563 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp @@ -33,7 +33,7 @@ MultilayerBaseOperation::MultilayerBaseOperation(int pass): BaseImageOperation() ImBuf* MultilayerBaseOperation::getImBuf() { RenderPass *rpass; rpass = (RenderPass *)BLI_findlink(&this->renderlayer->passes, this->passId); - if(rpass) { + if (rpass) { this->imageUser->pass= this->passId; BKE_image_multilayer_index(image->rr, this->imageUser); return BaseImageOperation::getImBuf(); @@ -49,7 +49,8 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe color[1] = 0.0f; color[2] = 0.0f; color[3] = 0.0f; - } else { + } + else { if (this->numberOfChannels == 4) { switch (sampler) { case COM_PS_NEAREST: @@ -62,7 +63,8 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe bicubic_interpolation_color(this->buffer, NULL, color, x, y); break; } - } else { + } + else { int offset = (yi*this->getWidth()+xi)*3; color[0] = this->imageBuffer[offset]; color[1] = this->imageBuffer[offset+1]; @@ -76,7 +78,8 @@ void MultilayerValueOperation::executePixel(float *color, float x, float y, Pixe int xi = x; if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) { color[0] = 0.0f; - } else { + } + else { float result = this->imageBuffer[yi*this->getWidth()+xi]; color[0] = result; } @@ -87,7 +90,8 @@ void MultilayerVectorOperation::executePixel(float *color, float x, float y, Pix int xi = x; if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) { color[0] = 0.0f; - } else { + } + else { int offset = (yi*this->getWidth()+xi)*3; color[0] = this->imageBuffer[offset]; color[1] = this->imageBuffer[offset+1]; diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp b/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp index 4cf50823c00..adaba8e3330 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp @@ -3,7 +3,7 @@ const char* sourcecode = "/// This file contains all opencl kernels for node-operation implementations \n" \ "\n" \ -"__kernel void testKernel(__global __write_only image2d_t output){\n" \ +"__kernel void testKernel(__global __write_only image2d_t output) {\n" \ " int x = get_global_id(0);\n" \ " int y = get_global_id(1);\n" \ " int2 coords = {x, y}; \n" \ diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index 5191c940f70..4a9d08380ea 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -52,7 +52,8 @@ void PreviewOperation::initExecution() { this->input = getInputSocketReader(0); if (!this->node->preview) { this->node->preview = (bNodePreview*)MEM_callocN(sizeof(bNodePreview), "node preview"); - } else { + } + else { if (this->getWidth() == (unsigned int)this->node->preview->xsize && this->getHeight() == (unsigned int)this->node->preview->ysize) { this->outputBuffer = this->node->preview->rect; } @@ -60,7 +61,7 @@ void PreviewOperation::initExecution() { if (this->outputBuffer == NULL) { this->outputBuffer = (unsigned char*)MEM_callocN(sizeof(unsigned char)*4*getWidth()*getHeight(), "PreviewOperation"); - if(this->node->preview->rect) { + if (this->node->preview->rect) { MEM_freeN(this->node->preview->rect); } this->node->preview->xsize= getWidth(); @@ -112,7 +113,8 @@ void PreviewOperation::determineResolution(unsigned int resolution[], unsigned i this->divider = 0.0f; if (width > height) { divider = COM_PREVIEW_SIZE / (width-1); - } else { + } + else { divider = COM_PREVIEW_SIZE / (height-1); } width = width * divider; diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index 483a75a69d2..69405ef6d23 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -48,7 +48,8 @@ void ReadBufferOperation::executePixel(float* color, float x, float y, PixelSamp if (inputBuffer) { if (sampler == COM_PS_NEAREST) { inputBuffer->read(color, x, y); - } else { + } + else { inputBuffer->readCubic(color, x, y); } } diff --git a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp index d85d54489ac..d18915c593b 100644 --- a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp @@ -36,7 +36,8 @@ void RenderLayersAlphaProg::executePixel(float* output, float x, float y, PixelS output[1] = 0.0f; output[2] = 0.0f; output[3] = 0.0f; - } else { + } + else { unsigned int offset = (iy*this->getWidth()+ix) * 4; output[0] = inputBuffer[offset+3]; output[1] = 0.0f; diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp index e63fcd5df4d..94ba8973314 100644 --- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp @@ -44,15 +44,15 @@ void RenderLayersBaseProg::initExecution() { Render *re= (scene)? RE_GetRender(scene->id.name): NULL; RenderResult *rr= NULL; - if(re) + if (re) rr= RE_AcquireResultRead(re); - if(rr) { + if (rr) { SceneRenderLayer *srl= (SceneRenderLayer*)BLI_findlink(&scene->r.layers, getLayerId()); - if(srl) { + if (srl) { RenderLayer *rl= RE_GetRenderLayer(rr, srl->name); - if(rl && rl->rectf) { + if (rl && rl->rectf) { this->inputBuffer = RE_RenderLayerGetPass(rl, renderpass); if (this->inputBuffer == NULL || renderpass == SCE_PASS_COMBINED) { @@ -76,19 +76,22 @@ void RenderLayersBaseProg::executePixel(float* output, float x, float y, PixelSa output[1] = 0.0f; output[2] = 0.0f; output[3] = 0.0f; - } else { + } + else { unsigned int offset = (iy*this->getWidth()+ix) * elementsize; if (elementsize == 1) { output[0] = inputBuffer[offset]; output[1] = 0.0f; output[2] = 0.0f; output[3] = 0.0f; - } else if (elementsize == 3){ + } + else if (elementsize == 3) { output[0] = inputBuffer[offset]; output[1] = inputBuffer[offset+1]; output[2] = inputBuffer[offset+2]; output[3] = 1.0f; - } else { + } + else { output[0] = inputBuffer[offset]; output[1] = inputBuffer[offset+1]; output[2] = inputBuffer[offset+2]; @@ -109,21 +112,21 @@ void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsign resolution[0] = 0; resolution[1] = 0; - if(re) + if (re) rr= RE_AcquireResultRead(re); - if(rr) { + if (rr) { SceneRenderLayer *srl= (SceneRenderLayer*)BLI_findlink(&sce->r.layers, getLayerId()); - if(srl) { + if (srl) { RenderLayer *rl= RE_GetRenderLayer(rr, srl->name); - if(rl && rl->rectf) { + if (rl && rl->rectf) { resolution[0]=rl->rectx; resolution[1]=rl->recty; } } } - if(re) + if (re) RE_ReleaseResult(re); } diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index ef6c5bee90a..ac2e8c5e8a9 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -42,7 +42,8 @@ void RotateOperation::initExecution() { double rad; if (this->doDegree2RadConversion) { rad = DEG2RAD(degree[0]); - } else { + } + else { rad = degree[0]; } this->cosine = cos(rad); diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index 87ef015384d..474874d4bb4 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -133,7 +133,8 @@ void ScreenLensDistortionOperation::executePixel(float* outputColor, int x, int /* set alpha */ outputColor[3]= 1.0f; - } else { + } + else { outputColor[0]= 0.0f; outputColor[1]= 0.0f; outputColor[2]= 0.0f; diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cpp b/source/blender/compositor/operations/COM_SetVectorOperation.cpp index b9c8f4bc369..3e9b68ac971 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.cpp +++ b/source/blender/compositor/operations/COM_SetVectorOperation.cpp @@ -38,7 +38,8 @@ void SetVectorOperation::determineResolution(unsigned int resolution[], unsigned if (preferredResolution[0] == 0 ||preferredResolution[1]==0) { resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH; resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT; - } else { + } + else { resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } diff --git a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp index f9000cc63da..f2d5e491001 100644 --- a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp @@ -77,17 +77,20 @@ void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me image1 = xSplit?x>perc:y>perc; if (image1) { image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers); - } else { + } + else { image2Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers); } /// @todo: linear conversion only when scene color management is selected, also check predivide. if (this->doColorManagement) { - if(this->doColorPredivide) { + if (this->doColorPredivide) { linearrgb_to_srgb_predivide_v4(srgb, buffer+offset); - } else { + } + else { linearrgb_to_srgb_v4(srgb, buffer+offset); } - } else { + } + else { copy_v4_v4(srgb, buffer+offset); } diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp index 1ca986f8893..3eb08140914 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cpp +++ b/source/blender/compositor/operations/COM_TextureOperation.cpp @@ -52,7 +52,8 @@ void TextureBaseOperation::determineResolution(unsigned int resolution[], unsign if (preferredResolution[0] == 0 || preferredResolution[1] == 0) { resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH; resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT; - } else { + } + else { resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } @@ -86,12 +87,12 @@ void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSam retval= multitex_ext(this->texture, vec, NULL, NULL, 0, &texres); - if(texres.talpha) + if (texres.talpha) color[3]= texres.ta; else color[3]= texres.tin; - if((retval & TEX_RGB)) { + if ((retval & TEX_RGB)) { color[0]= texres.tr; color[1]= texres.tg; color[2]= texres.tb; diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index e97b1155e22..83b9f55b431 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -84,7 +84,9 @@ void VariableSizeBokehBlurOperation::executePixel(float* color, int x, int y, Me float dx = nx - x; float dy = ny - y; if (nx == x && ny == y) { - } else if (size>= fabs(dx) && size >= fabs(dy)) { + /* pass */ + } + else if (size>= fabs(dx) && size >= fabs(dy)) { float u = 256+ dx*256/size; float v = 256+ dy*256/size; inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers); diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp index 7d660177fbb..7b6ebe9728f 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp @@ -94,7 +94,8 @@ bool VectorBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuff newInput.ymax = this->getHeight(); newInput.ymin = 0; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); - } else { + } + else { return false; } } diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp index 16143af7165..85b5cc4c3a8 100644 --- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp @@ -86,7 +86,8 @@ void ViewerBaseOperation::deinitExecution() { const int ViewerBaseOperation::getRenderPriority() const { if (this->isActiveViewerOutput()) { return 8; - } else { + } + else { return 0; } } diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index b0d443f1cbd..8fa63329e1f 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -85,12 +85,14 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryB } /// @todo: linear conversion only when scene color management is selected, also check predivide. if (this->doColorManagement) { - if(this->doColorPredivide) { + if (this->doColorPredivide) { linearrgb_to_srgb_predivide_v4(srgb, buffer+offset); - } else { + } + else { linearrgb_to_srgb_v4(srgb, buffer+offset); } - } else { + } + else { copy_v4_v4(srgb, buffer+offset); } diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index 44a769ee947..6bb38c007ef 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -80,7 +80,8 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me this->input->deinitializeTileData(rect, memoryBuffers, data); data = NULL; } - } else { + } + else { int x1 = rect->xmin; int y1 = rect->ymin; int x2 = rect->xmax; diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp index 9aa06df1ead..e45d66dd597 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp @@ -52,7 +52,8 @@ void ZCombineOperation::executePixel(float* color, float x, float y, PixelSample this->depth2Reader->read(depth2, x, y, sampler, inputBuffers); if (depth1[0]<depth2[0]) { this->image1Reader->read(color, x, y, sampler, inputBuffers); - } else { + } + else { this->image2Reader->read(color, x, y, sampler, inputBuffers); } } @@ -67,7 +68,8 @@ void ZCombineAlphaOperation::executePixel(float* color, float x, float y, PixelS if (depth1[0]<depth2[0]) { this->image1Reader->read(color1, x, y, sampler, inputBuffers); this->image2Reader->read(color2, x, y, sampler, inputBuffers); - } else { + } + else { this->image1Reader->read(color2, x, y, sampler, inputBuffers); this->image2Reader->read(color1, x, y, sampler, inputBuffers); } |