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:
Diffstat (limited to 'source/blender/compositor/operations/COM_ScaleOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.cpp162
1 files changed, 81 insertions, 81 deletions
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp
index 2e23df73b67..6a1f7b62203 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp
@@ -33,24 +33,24 @@ ScaleOperation::ScaleOperation() : NodeOperation()
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
this->setResolutionInputSocketIndex(0);
- this->inputOperation = NULL;
- this->inputXOperation = NULL;
- this->inputYOperation = NULL;
+ this->m_inputOperation = NULL;
+ this->m_inputXOperation = NULL;
+ this->m_inputYOperation = NULL;
}
void ScaleOperation::initExecution()
{
- this->inputOperation = this->getInputSocketReader(0);
- this->inputXOperation = this->getInputSocketReader(1);
- this->inputYOperation = this->getInputSocketReader(2);
- this->centerX = this->getWidth() / 2.0;
- this->centerY = this->getHeight() / 2.0;
+ this->m_inputOperation = this->getInputSocketReader(0);
+ this->m_inputXOperation = this->getInputSocketReader(1);
+ this->m_inputYOperation = this->getInputSocketReader(2);
+ this->m_centerX = this->getWidth() / 2.0;
+ this->m_centerY = this->getHeight() / 2.0;
}
void ScaleOperation::deinitExecution()
{
- this->inputOperation = NULL;
- this->inputXOperation = NULL;
- this->inputYOperation = NULL;
+ this->m_inputOperation = NULL;
+ this->m_inputXOperation = NULL;
+ this->m_inputYOperation = NULL;
}
@@ -63,15 +63,15 @@ void ScaleOperation::executePixel(float *color, float x, float y, PixelSampler s
float scaleX[4];
float scaleY[4];
- this->inputXOperation->read(scaleX, x, y, sampler, inputBuffers);
- this->inputYOperation->read(scaleY, x, y, sampler, inputBuffers);
+ this->m_inputXOperation->read(scaleX, x, y, sampler, inputBuffers);
+ this->m_inputYOperation->read(scaleY, x, y, sampler, inputBuffers);
const float scx = scaleX[0];
const float scy = scaleY[0];
- float nx = this->centerX + (x - this->centerX) / scx;
- float ny = this->centerY + (y - this->centerY) / scy;
- this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
+ float nx = this->m_centerX + (x - this->m_centerX) / scx;
+ float ny = this->m_centerY + (y - this->m_centerY) / scy;
+ this->m_inputOperation->read(color, nx, ny, sampler, inputBuffers);
}
bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -80,16 +80,16 @@ bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe
float scaleX[4];
float scaleY[4];
- this->inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST, NULL);
- this->inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST, NULL);
const float scx = scaleX[0];
const float scy = scaleY[0];
- newInput.xmax = this->centerX + (input->xmax - this->centerX) / scx;
- newInput.xmin = this->centerX + (input->xmin - this->centerX) / scx;
- newInput.ymax = this->centerY + (input->ymax - this->centerY) / scy;
- newInput.ymin = this->centerY + (input->ymin - this->centerY) / scy;
+ newInput.xmax = this->m_centerX + (input->xmax - this->m_centerX) / scx;
+ newInput.xmin = this->m_centerX + (input->xmin - this->m_centerX) / scx;
+ newInput.ymax = this->m_centerY + (input->ymax - this->m_centerY) / scy;
+ newInput.ymin = this->m_centerY + (input->ymin - this->m_centerY) / scy;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -103,24 +103,24 @@ ScaleAbsoluteOperation::ScaleAbsoluteOperation() : NodeOperation()
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
this->setResolutionInputSocketIndex(0);
- this->inputOperation = NULL;
- this->inputXOperation = NULL;
- this->inputYOperation = NULL;
+ this->m_inputOperation = NULL;
+ this->m_inputXOperation = NULL;
+ this->m_inputYOperation = NULL;
}
void ScaleAbsoluteOperation::initExecution()
{
- this->inputOperation = this->getInputSocketReader(0);
- this->inputXOperation = this->getInputSocketReader(1);
- this->inputYOperation = this->getInputSocketReader(2);
- this->centerX = this->getWidth() / 2.0;
- this->centerY = this->getHeight() / 2.0;
+ this->m_inputOperation = this->getInputSocketReader(0);
+ this->m_inputXOperation = this->getInputSocketReader(1);
+ this->m_inputYOperation = this->getInputSocketReader(2);
+ this->m_centerX = this->getWidth() / 2.0;
+ this->m_centerY = this->getHeight() / 2.0;
}
void ScaleAbsoluteOperation::deinitExecution()
{
- this->inputOperation = NULL;
- this->inputXOperation = NULL;
- this->inputYOperation = NULL;
+ this->m_inputOperation = NULL;
+ this->m_inputXOperation = NULL;
+ this->m_inputYOperation = NULL;
}
@@ -133,8 +133,8 @@ void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelS
float scaleX[4];
float scaleY[4];
- this->inputXOperation->read(scaleX, x, y, sampler, inputBuffers);
- this->inputYOperation->read(scaleY, x, y, sampler, inputBuffers);
+ this->m_inputXOperation->read(scaleX, x, y, sampler, inputBuffers);
+ this->m_inputYOperation->read(scaleY, x, y, sampler, inputBuffers);
const float scx = scaleX[0]; // target absolute scale
const float scy = scaleY[0]; // target absolute scale
@@ -145,10 +145,10 @@ void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelS
float relativeXScale = scx / width;
float relativeYScale = scy / height;
- float nx = this->centerX + (x - this->centerX) / relativeXScale;
- float ny = this->centerY + (y - this->centerY) / relativeYScale;
+ float nx = this->m_centerX + (x - this->m_centerX) / relativeXScale;
+ float ny = this->m_centerY + (y - this->m_centerY) / relativeYScale;
- this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
+ this->m_inputOperation->read(color, nx, ny, sampler, inputBuffers);
}
bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -157,8 +157,8 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadB
float scaleX[4];
float scaleY[4];
- this->inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST, NULL);
- this->inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_inputXOperation->read(scaleX, 0, 0, COM_PS_NEAREST, NULL);
+ this->m_inputYOperation->read(scaleY, 0, 0, COM_PS_NEAREST, NULL);
const float scx = scaleX[0];
const float scy = scaleY[0];
@@ -168,10 +168,10 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadB
float relateveXScale = scx / width;
float relateveYScale = scy / height;
- newInput.xmax = this->centerX + (input->xmax - this->centerX) / relateveXScale;
- newInput.xmin = this->centerX + (input->xmin - this->centerX) / relateveXScale;
- newInput.ymax = this->centerY + (input->ymax - this->centerY) / relateveYScale;
- newInput.ymin = this->centerY + (input->ymin - this->centerY) / relateveYScale;
+ newInput.xmax = this->m_centerX + (input->xmax - this->m_centerX) / relateveXScale;
+ newInput.xmin = this->m_centerX + (input->xmin - this->m_centerX) / relateveXScale;
+ newInput.ymax = this->m_centerY + (input->ymax - this->m_centerY) / relateveYScale;
+ newInput.ymin = this->m_centerY + (input->ymin - this->m_centerY) / relateveYScale;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -180,59 +180,59 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadB
// Absolute fixed siez
ScaleFixedSizeOperation::ScaleFixedSizeOperation() : NodeOperation()
{
- this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
this->addOutputSocket(COM_DT_COLOR);
this->setResolutionInputSocketIndex(0);
- this->inputOperation = NULL;
+ this->m_inputOperation = NULL;
}
void ScaleFixedSizeOperation::initExecution()
{
- this->inputOperation = this->getInputSocketReader(0);
- this->relX = inputOperation->getWidth() / (float)this->newWidth;
- this->relY = inputOperation->getHeight() / (float)this->newHeight;
+ this->m_inputOperation = this->getInputSocketReader(0);
+ this->m_relX = this->m_inputOperation->getWidth() / (float)this->m_newWidth;
+ this->m_relY = this->m_inputOperation->getHeight() / (float)this->m_newHeight;
/* *** all the options below are for a fairly special case - camera framing *** */
- if (this->offsetX != 0.0f || this->offsetY != 0.0f) {
- this->is_offset = true;
+ if (this->m_offsetX != 0.0f || this->m_offsetY != 0.0f) {
+ this->m_is_offset = true;
- if (this->newWidth > this->newHeight) {
- this->offsetX *= this->newWidth;
- this->offsetY *= this->newWidth;
+ if (this->m_newWidth > this->m_newHeight) {
+ this->m_offsetX *= this->m_newWidth;
+ this->m_offsetY *= this->m_newWidth;
}
else {
- this->offsetX *= this->newHeight;
- this->offsetY *= this->newHeight;
+ this->m_offsetX *= this->m_newHeight;
+ this->m_offsetY *= this->m_newHeight;
}
}
- if (this->is_aspect) {
+ if (this->m_is_aspect) {
/* apply aspect from clip */
- const float w_src = inputOperation->getWidth();
- const float h_src = inputOperation->getHeight();
+ const float w_src = this->m_inputOperation->getWidth();
+ const float h_src = this->m_inputOperation->getHeight();
/* destination aspect is already applied from the camera frame */
- const float w_dst = this->newWidth;
- const float h_dst = this->newHeight;
+ const float w_dst = this->m_newWidth;
+ const float h_dst = this->m_newHeight;
const float asp_src = w_src / h_src;
const float asp_dst = w_dst / h_dst;
if (fabsf(asp_src - asp_dst) >= FLT_EPSILON) {
- if ((asp_src > asp_dst) == (this->is_crop == true)) {
+ if ((asp_src > asp_dst) == (this->m_is_crop == true)) {
/* fit X */
const float div = asp_src / asp_dst;
- this->relX /= div;
- this->offsetX += ((w_src - (w_src * div)) / (w_src / w_dst)) / 2.0f;
+ this->m_relX /= div;
+ this->m_offsetX += ((w_src - (w_src * div)) / (w_src / w_dst)) / 2.0f;
}
else {
/* fit Y */
const float div = asp_dst / asp_src;
- this->relY /= div;
- this->offsetY += ((h_src - (h_src * div)) / (h_src / h_dst)) / 2.0f;
+ this->m_relY /= div;
+ this->m_offsetY += ((h_src - (h_src * div)) / (h_src / h_dst)) / 2.0f;
}
- this->is_offset = true;
+ this->m_is_offset = true;
}
}
/* *** end framing options *** */
@@ -240,7 +240,7 @@ void ScaleFixedSizeOperation::initExecution()
void ScaleFixedSizeOperation::deinitExecution()
{
- this->inputOperation = NULL;
+ this->m_inputOperation = NULL;
}
@@ -250,13 +250,13 @@ void ScaleFixedSizeOperation::executePixel(float *color, float x, float y, Pixel
sampler = COM_PS_BICUBIC;
#endif
- if (this->is_offset) {
- float nx = ((x - this->offsetX) * relX);
- float ny = ((y - this->offsetY) * relY);
- this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
+ if (this->m_is_offset) {
+ float nx = ((x - this->m_offsetX) * this->m_relX);
+ float ny = ((y - this->m_offsetY) * this->m_relY);
+ this->m_inputOperation->read(color, nx, ny, sampler, inputBuffers);
}
else {
- this->inputOperation->read(color, x * relX, y * relY, sampler, inputBuffers);
+ this->m_inputOperation->read(color, x * this->m_relX, y * this->m_relY, sampler, inputBuffers);
}
}
@@ -264,10 +264,10 @@ bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, Read
{
rcti newInput;
- newInput.xmax = input->xmax * relX;
- newInput.xmin = input->xmin * relX;
- newInput.ymax = input->ymax * relY;
- newInput.ymin = input->ymin * relY;
+ newInput.xmax = input->xmax * this->m_relX;
+ newInput.xmin = input->xmin * this->m_relX;
+ newInput.ymax = input->ymax * this->m_relY;
+ newInput.ymin = input->ymin * this->m_relY;
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
@@ -275,9 +275,9 @@ bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, Read
void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
unsigned int nr[2];
- nr[0] = newWidth;
- nr[1] = newHeight;
+ nr[0] = this->m_newWidth;
+ nr[1] = this->m_newHeight;
NodeOperation::determineResolution(resolution, nr);
- resolution[0] = newWidth;
- resolution[1] = newHeight;
+ resolution[0] = this->m_newWidth;
+ resolution[1] = this->m_newHeight;
}