diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-15 13:58:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-15 13:58:52 +0400 |
commit | ec755bdfa7920c9db4dd771c065e85539b00d140 (patch) | |
tree | fc05b551bd397aae04c478a5fcb6ea7c0be05b2e /source/blender/compositor/operations/COM_BokehBlurOperation.cpp | |
parent | 3264db37972877184ead9785181722e5cf65f164 (diff) |
style cleanup: composite/blur
Diffstat (limited to 'source/blender/compositor/operations/COM_BokehBlurOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_BokehBlurOperation.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index 67e24496cbe..dca087bb587 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -59,15 +59,15 @@ void BokehBlurOperation::initExecution() int height = inputBokehProgram->getHeight(); float dimension; - if (width<height) { + if (width < height) { dimension = width; } else { dimension = height; } - this->bokehMidX = width/2.0f; - this->bokehMidY = height/2.0f; - this->bokehDimension = dimension/2.0f; + this->bokehMidX = width / 2.0f; + this->bokehMidY = height / 2.0f; + this->bokehDimension = dimension / 2.0f; QualityStepHelper::initExecution(COM_QH_INCREASE); } @@ -78,14 +78,14 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer * float bokeh[4]; inputBoundingBoxReader->read(tempBoundingBox, x, y, COM_PS_NEAREST, inputBuffers); - if (tempBoundingBox[0] >0.0f) { + if (tempBoundingBox[0] > 0.0f) { float overallmultiplyer[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; int bufferstarty = inputBuffer->getRect()->ymin; - int pixelSize = this->size*this->getWidth()/100.0f; + int pixelSize = this->size * this->getWidth() / 100.0f; int miny = y - pixelSize; int maxy = y + pixelSize; @@ -101,16 +101,16 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer * int step = getStep(); int offsetadd = getOffsetAdd(); - float m = this->bokehDimension/pixelSize; - for (int ny = miny ; ny < maxy ; ny +=step) { - int bufferindex = ((minx - bufferstartx)*4)+((ny-bufferstarty)*4*bufferwidth); - for (int nx = minx ; nx < maxx ; nx +=step) { - float u = this->bokehMidX - (nx-x) *m; - float v = this->bokehMidY - (ny-y) *m; + float m = this->bokehDimension / pixelSize; + for (int ny = miny; ny < maxy; ny += step) { + int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth); + for (int nx = minx; nx < maxx; nx += step) { + float u = this->bokehMidX - (nx - x) * m; + float v = this->bokehMidY - (ny - y) * m; inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers); madd_v4_v4v4(tempColor, bokeh, &buffer[bufferindex]); add_v4_v4(overallmultiplyer, bokeh); - bufferindex +=offsetadd; + bufferindex += offsetadd; } } color[0] = tempColor[0] * (1.0f / overallmultiplyer[0]); @@ -135,10 +135,10 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe rcti newInput; rcti bokehInput; - newInput.xmax = input->xmax + (size*this->getWidth()/100.0f); - newInput.xmin = input->xmin - (size*this->getWidth()/100.0f); - newInput.ymax = input->ymax + (size*this->getWidth()/100.0f); - newInput.ymin = input->ymin - (size*this->getWidth()/100.0f); + newInput.xmax = input->xmax + (size * this->getWidth() / 100.0f); + newInput.xmin = input->xmin - (size * this->getWidth() / 100.0f); + newInput.ymax = input->ymax + (size * this->getWidth() / 100.0f); + newInput.ymin = input->ymin - (size * this->getWidth() / 100.0f); NodeOperation *operation = getInputOperation(1); bokehInput.xmax = operation->getWidth(); @@ -168,7 +168,7 @@ void BokehBlurOperation::executeOpenCL(cl_context context, cl_program program, c if (!kernel) { kernel = COM_clCreateKernel(program, "bokehBlurKernel", NULL); } - cl_int radius = this->getWidth()*this->size/100.0f; + cl_int radius = this->getWidth() * this->size / 100.0f; cl_int step = this->getStep(); COM_clAttachMemoryBufferToKernelParameter(context, kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->inputBoundingBoxReader); |