diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-13 17:59:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-13 17:59:46 +0400 |
commit | 29165fc373aace1cef7b070112ebfc4301ef8f95 (patch) | |
tree | eccc4a956d2aa6ffa644d593ceb1d675aa044fd8 /source/blender/compositor/operations/COM_GlareGhostOperation.cpp | |
parent | 2e72720718d80d3659a4f84143905b0e69724186 (diff) |
style cleanup
Diffstat (limited to 'source/blender/compositor/operations/COM_GlareGhostOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_GlareGhostOperation.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp index 383a13c54de..defbd76fa51 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp @@ -27,8 +27,8 @@ static float smoothMask(float x, float y) { float t; - x = 2.f*x - 1.f, y = 2.f*y - 1.f; - if ((t = 1.f - sqrtf(x*x + y*y)) <= 0.f) return 0.f; + x = 2.f * x - 1.f, y = 2.f * y - 1.f; + if ((t = 1.f - sqrtf(x * x + y * y)) <= 0.f) return 0.f; return t; } @@ -36,7 +36,7 @@ static float smoothMask(float x, float y) void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) { const int qt = 1 << settings->quality; - const float s1 = 4.f/(float)qt, s2 = 2.f*s1; + const float s1 = 4.f / (float)qt, s2 = 2.f * s1; int x, y, n, p, np; fRGB c, tc, cm[64]; float sc, isc, u, v, sm, s, t, ofs, scalef[64]; @@ -46,77 +46,77 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No MemoryBuffer *tbuf1 = inputTile->duplicate(); bool breaked = false; - + FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 0, 3); if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 1, 3); if (isBreaked()) breaked = true; if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 2, 3); - + MemoryBuffer *tbuf2 = tbuf1->duplicate(); - + if (isBreaked()) breaked = true; if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 0, 3); if (isBreaked()) breaked = true; if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 1, 3); if (isBreaked()) breaked = true; if (!breaked) FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 2, 3); - + if (settings->iter & 1) ofs = 0.5f; else ofs = 0.f; - for (x=0; x<(settings->iter*4); x++) { + for (x = 0; x < (settings->iter * 4); x++) { y = x & 3; cm[x][0] = cm[x][1] = cm[x][2] = 1; - if (y==1) fRGB_rgbmult(cm[x], 1.f, cmo, cmo); - if (y==2) fRGB_rgbmult(cm[x], cmo, cmo, 1.f); - if (y==3) fRGB_rgbmult(cm[x], cmo, 1.f, cmo); - scalef[x] = 2.1f*(1.f-(x+ofs)/(float)(settings->iter*4)); - if (x & 1) scalef[x] = -0.99f/scalef[x]; + if (y == 1) fRGB_rgbmult(cm[x], 1.f, cmo, cmo); + if (y == 2) fRGB_rgbmult(cm[x], cmo, cmo, 1.f); + if (y == 3) fRGB_rgbmult(cm[x], cmo, 1.f, cmo); + scalef[x] = 2.1f * (1.f - (x + ofs) / (float)(settings->iter * 4)); + if (x & 1) scalef[x] = -0.99f / scalef[x]; } sc = 2.13; isc = -0.97; - for (y=0; y<gbuf->getHeight() &(!breaked); y++) { - v = (float)(y+0.5f) / (float)gbuf->getHeight(); - for (x=0; x<gbuf->getWidth(); x++) { - u = (float)(x+0.5f) / (float)gbuf->getWidth(); - s = (u-0.5f)*sc + 0.5f, t = (v-0.5f)*sc + 0.5f; - tbuf1->read(c, s*gbuf->getWidth(), t*gbuf->getHeight()); + for (y = 0; y < gbuf->getHeight() & (!breaked); y++) { + v = (float)(y + 0.5f) / (float)gbuf->getHeight(); + for (x = 0; x < gbuf->getWidth(); x++) { + u = (float)(x + 0.5f) / (float)gbuf->getWidth(); + s = (u - 0.5f) * sc + 0.5f, t = (v - 0.5f) * sc + 0.5f; + tbuf1->read(c, s * gbuf->getWidth(), t * gbuf->getHeight()); sm = smoothMask(s, t); fRGB_mult(c, sm); - s = (u-0.5f)*isc + 0.5f, t = (v-0.5f)*isc + 0.5f; - tbuf2->read(tc, s*gbuf->getWidth()-0.5f, t*gbuf->getHeight()-0.5f); + s = (u - 0.5f) * isc + 0.5f, t = (v - 0.5f) * isc + 0.5f; + tbuf2->read(tc, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f); sm = smoothMask(s, t); fRGB_madd(c, tc, sm); - + gbuf->writePixel(x, y, c); } if (isBreaked()) breaked = true; - + } - memset(tbuf1->getBuffer(), 0, tbuf1->getWidth()*tbuf1->getHeight()*COM_NUMBER_OF_CHANNELS*sizeof(float)); - for (n=1; n<settings->iter &(!breaked); n++) { - for (y=0; y<gbuf->getHeight()&(!breaked); y++) { - v = (float)(y+0.5f) / (float)gbuf->getHeight(); - for (x=0; x<gbuf->getWidth(); x++) { - u = (float)(x+0.5f) / (float)gbuf->getWidth(); + memset(tbuf1->getBuffer(), 0, tbuf1->getWidth() * tbuf1->getHeight() * COM_NUMBER_OF_CHANNELS * sizeof(float)); + for (n = 1; n < settings->iter & (!breaked); n++) { + for (y = 0; y < gbuf->getHeight() & (!breaked); y++) { + v = (float)(y + 0.5f) / (float)gbuf->getHeight(); + for (x = 0; x < gbuf->getWidth(); x++) { + u = (float)(x + 0.5f) / (float)gbuf->getWidth(); tc[0] = tc[1] = tc[2] = 0.f; - for (p=0;p<4;p++) { - np = (n<<2) + p; - s = (u-0.5f)*scalef[np] + 0.5f; - t = (v-0.5f)*scalef[np] + 0.5f; - gbuf->read(c, s*gbuf->getWidth() - 0.5f, t*gbuf->getHeight() - 0.5f); + for (p = 0; p < 4; p++) { + np = (n << 2) + p; + s = (u - 0.5f) * scalef[np] + 0.5f; + t = (v - 0.5f) * scalef[np] + 0.5f; + gbuf->read(c, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f); fRGB_colormult(c, cm[np]); - sm = smoothMask(s, t)*0.25f; + sm = smoothMask(s, t) * 0.25f; fRGB_madd(tc, c, sm); } tbuf1->writePixel(x, y, tc); } if (isBreaked()) breaked = true; } - memcpy(gbuf->getBuffer(), tbuf1->getBuffer(), tbuf1->getWidth()*tbuf1->getHeight()*COM_NUMBER_OF_CHANNELS*sizeof(float)); + memcpy(gbuf->getBuffer(), tbuf1->getBuffer(), tbuf1->getWidth() * tbuf1->getHeight() * COM_NUMBER_OF_CHANNELS * sizeof(float)); } - memcpy(data, gbuf->getBuffer(), gbuf->getWidth()*gbuf->getHeight()*COM_NUMBER_OF_CHANNELS*sizeof(float)); - + memcpy(data, gbuf->getBuffer(), gbuf->getWidth() * gbuf->getHeight() * COM_NUMBER_OF_CHANNELS * sizeof(float)); + delete gbuf; delete tbuf1; delete tbuf2; |