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_GaussianBokehBlurOperation.cpp | |
parent | 3264db37972877184ead9785181722e5cf65f164 (diff) |
style cleanup: composite/blur
Diffstat (limited to 'source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index 80e35f63ac5..b5ae54299eb 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -27,7 +27,7 @@ extern "C" { #include "RE_pipeline.h" } -GaussianBokehBlurOperation::GaussianBokehBlurOperation(): BlurBaseOperation() +GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation() { this->gausstab = NULL; } @@ -65,42 +65,42 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) if (!sizeavailable) { updateSize(memoryBuffers); } - radxf = size*(float)this->data->sizex; - if (radxf>width/2.0f) - radxf = width/2.0f; - else if (radxf<1.0f) + radxf = size * (float)this->data->sizex; + if (radxf > width / 2.0f) + radxf = width / 2.0f; + else if (radxf < 1.0f) radxf = 1.0f; /* vertical */ - radyf = size*(float)this->data->sizey; - if (radyf>height/2.0f) - radyf = height/2.0f; - else if (radyf<1.0f) + radyf = size * (float)this->data->sizey; + if (radyf > height / 2.0f) + radyf = height / 2.0f; + else if (radyf < 1.0f) radyf = 1.0f; radx = ceil(radxf); rady = ceil(radyf); - n = (2*radx+1)*(2*rady+1); + n = (2 * radx + 1) * (2 * rady + 1); /* create a full filter image */ 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); *dgauss = RE_filter_value(this->data->filtertype, dist); - val+= *dgauss; + val += *dgauss; } } - if (val!=0.0f) { - val = 1.0f/val; - for (j = n - 1; j>=0; j--) - ddgauss[j]*= val; + if (val != 0.0f) { + val = 1.0f / val; + for (j = n - 1; j >= 0; j--) + ddgauss[j] *= val; } else ddgauss[4] = 1.0f; @@ -116,7 +116,7 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, Memory tempColor[2] = 0; tempColor[3] = 0; float overallmultiplyer = 0; - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; @@ -134,15 +134,15 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, Memory int index; int step = QualityStepHelper::getStep(); int offsetadd = QualityStepHelper::getOffsetAdd(); - for (int ny = miny ; ny < maxy ; ny +=step) { - index = ((ny-y)+this->rady) * (this->radx*2+1) + (minx-x+this->radx); - int bufferindex = ((minx - bufferstartx)*4)+((ny-bufferstarty)*4*bufferwidth); - for (int nx = minx ; nx < maxx ; nx +=step) { + for (int ny = miny; ny < maxy; ny += step) { + index = ((ny - y) + this->rady) * (this->radx * 2 + 1) + (minx - x + this->radx); + int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth); + for (int nx = minx; nx < maxx; nx += step) { const float multiplyer = gausstab[index]; madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplyer); overallmultiplyer += multiplyer; index += step; - bufferindex +=offsetadd; + bufferindex += offsetadd; } } @@ -164,7 +164,7 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R sizeInput.ymin = 0; sizeInput.xmax = 5; sizeInput.ymax = 5; - NodeOperation * operation = this->getInputOperation(1); + NodeOperation *operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; |