Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-16 18:40:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-16 18:40:16 +0400
commit6fc277c410d5ee4d13562e4b8b260bc0929f30f5 (patch)
tree5c7af757a8ae2c4d55fed565ef058843fef05209 /source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
parente946fa443b5aab057bfe5f40f8bb4f346c84331e (diff)
support for negative feather dilate/erode
Diffstat (limited to 'source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index f84f4e3b094..40f74ad4485 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -79,8 +79,14 @@ void GaussianAlphaYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers)
}
}
+BLI_INLINE float finv_test(const float f, const bool test)
+{
+ return (LIKELY(test == false)) ? f : 1.0f - f;
+}
+
void GaussianAlphaYBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
+ const bool do_invert = this->do_subtract;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
int bufferwidth = inputBuffer->getWidth();
@@ -104,14 +110,14 @@ void GaussianAlphaYBlurOperation::executePixel(float *color, int x, int y, Memor
float overallmultiplyer = 0.0f;
/* dilate */
- float value_max = buffer[(x * 4) + (y * 4 * bufferwidth)]; /* init with the current color to avoid unneeded lookups */
+ float value_max = finv_test(buffer[(x * 4) + (y * 4 * bufferwidth)], do_invert); /* init with the current color to avoid unneeded lookups */
float distfacinv_max = 1.0f; /* 0 to 1 */
for (int ny = miny; ny < maxy; ny += step) {
int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
const int index = (ny - y) + this->rad;
- float value = buffer[bufferindex];
+ float value = finv_test(buffer[bufferindex], do_invert);
float multiplyer;
/* gauss */
@@ -140,7 +146,7 @@ void GaussianAlphaYBlurOperation::executePixel(float *color, int x, int y, Memor
/* blend between the max value and gauss blue - gives nice feather */
const float value_gauss = tempColor / overallmultiplyer;
const float value_final = (value_max * distfacinv_max) + (value_gauss * (1.0f - distfacinv_max));
- color[0] = value_final;
+ color[0] = finv_test(value_final, do_invert);
}
void GaussianAlphaYBlurOperation::deinitExecution()