[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49762] trunk/blender/source/blender/ compositor/operations/COM_BokehBlurOperation.cpp: minor compositor change: use the max dimension for bokeh blur size, rather then width.
Campbell Barton
ideasman42 at gmail.com
Fri Aug 10 12:20:29 CEST 2012
Revision: 49762
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49762
Author: campbellbarton
Date: 2012-08-10 10:20:28 +0000 (Fri, 10 Aug 2012)
Log Message:
-----------
minor compositor change: use the max dimension for bokeh blur size, rather then width.
Modified Paths:
--------------
trunk/blender/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
Modified: trunk/blender/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_BokehBlurOperation.cpp 2012-08-10 10:15:45 UTC (rev 49761)
+++ trunk/blender/source/blender/compositor/operations/COM_BokehBlurOperation.cpp 2012-08-10 10:20:28 UTC (rev 49762)
@@ -66,13 +66,8 @@
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 @@
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 @@
{
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 @@
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);
More information about the Bf-blender-cvs
mailing list