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-08-10 14:20:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-10 14:20:28 +0400
commit3c35f560db8f5afec282b4c380e12152783470e4 (patch)
tree8cacbb2239ae14f3798ba60d9382351d0b6c0289 /source/blender/compositor/operations/COM_BokehBlurOperation.cpp
parentd33a0effbaa42f577c8474b7d07a6deef75e0e7a (diff)
minor compositor change: use the max dimension for bokeh blur size, rather then width.
Diffstat (limited to 'source/blender/compositor/operations/COM_BokehBlurOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
index 46c27496e9a..7d126eb0539 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
@@ -66,13 +66,8 @@ void BokehBlurOperation::initExecution()
int width = this->m_inputBokehProgram->getWidth();
int height = this->m_inputBokehProgram->getHeight();
- float dimension;
- if (width < height) {
- dimension = width;
- }
- else {
- dimension = height;
- }
+ float dimension = min(width, height);
+
this->m_bokehMidX = width / 2.0f;
this->m_bokehMidY = height / 2.0f;
this->m_bokehDimension = dimension / 2.0f;
@@ -93,7 +88,8 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, void *data)
int bufferwidth = inputBuffer->getWidth();
int bufferstartx = inputBuffer->getRect()->xmin;
int bufferstarty = inputBuffer->getRect()->ymin;
- int pixelSize = this->m_size * this->getWidth() / 100.0f;
+ const float max_dim = max(this->getWidth(), this->getHeight());
+ int pixelSize = this->m_size * max_dim / 100.0f;
zero_v4(color_accum);
if (pixelSize<2) {
@@ -150,18 +146,19 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
{
rcti newInput;
rcti bokehInput;
+ const float max_dim = max(this->getWidth(), this->getHeight());
if (this->m_sizeavailable) {
- newInput.xmax = input->xmax + (this->m_size * this->getWidth() / 100.0f);
- newInput.xmin = input->xmin - (this->m_size * this->getWidth() / 100.0f);
- newInput.ymax = input->ymax + (this->m_size * this->getWidth() / 100.0f);
- newInput.ymin = input->ymin - (this->m_size * this->getWidth() / 100.0f);
+ newInput.xmax = input->xmax + (this->m_size * max_dim / 100.0f);
+ newInput.xmin = input->xmin - (this->m_size * max_dim / 100.0f);
+ newInput.ymax = input->ymax + (this->m_size * max_dim / 100.0f);
+ newInput.ymin = input->ymin - (this->m_size * max_dim / 100.0f);
}
else {
- newInput.xmax = input->xmax + (10.0f * this->getWidth() / 100.0f);
- newInput.xmin = input->xmin - (10.0f * this->getWidth() / 100.0f);
- newInput.ymax = input->ymax + (10.0f * this->getWidth() / 100.0f);
- newInput.ymin = input->ymin - (10.0f * this->getWidth() / 100.0f);
+ newInput.xmax = input->xmax + (10.0f * max_dim / 100.0f);
+ newInput.xmin = input->xmin - (10.0f * max_dim / 100.0f);
+ newInput.ymax = input->ymax + (10.0f * max_dim / 100.0f);
+ newInput.ymin = input->ymin - (10.0f * max_dim / 100.0f);
}
NodeOperation *operation = getInputOperation(1);
@@ -203,7 +200,8 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device,
if (!this->m_sizeavailable) {
updateSize();
}
- cl_int radius = this->getWidth() * this->m_size / 100.0f;
+ const float max_dim = max(this->getWidth(), this->getHeight());
+ cl_int radius = this->m_size * max_dim / 100.0f;
cl_int step = this->getStep();
device->COM_clAttachMemoryBufferToKernelParameter(kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBoundingBoxReader);