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_CropOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index 3c4e3428ec2..192ad8d0bda 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -23,22 +23,24 @@
#include "COM_CropOperation.h"
#include "BLI_math.h"
-CropBaseOperation::CropBaseOperation() :NodeOperation() {
+CropBaseOperation::CropBaseOperation() :NodeOperation()
+{
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
this->addOutputSocket(COM_DT_COLOR);
this->inputOperation = NULL;
this->settings = NULL;
}
-void CropBaseOperation::updateArea() {
+void CropBaseOperation::updateArea()
+{
SocketReader * inputReference = this->getInputSocketReader(0);
float width = inputReference->getWidth();
float height = inputReference->getHeight();
if (this->relative) {
- settings->x1= width * settings->fac_x1;
- settings->x2= width * settings->fac_x2;
- settings->y1= height * settings->fac_y1;
- settings->y2= height * settings->fac_y2;
+ settings->x1 = width * settings->fac_x1;
+ settings->x2 = width * settings->fac_x2;
+ settings->y1 = height * settings->fac_y1;
+ settings->y2 = height * settings->fac_y2;
}
if (width <= settings->x1 + 1)
settings->x1 = width - 1;
@@ -55,19 +57,23 @@ void CropBaseOperation::updateArea() {
this->ymin = MIN2(settings->y1, settings->y2);
}
-void CropBaseOperation::initExecution() {
+void CropBaseOperation::initExecution()
+{
this->inputOperation = this->getInputSocketReader(0);
updateArea();
}
-void CropBaseOperation::deinitExecution() {
+void CropBaseOperation::deinitExecution()
+{
this->inputOperation = NULL;
}
-CropOperation::CropOperation() :CropBaseOperation() {
+CropOperation::CropOperation() :CropBaseOperation()
+{
}
-void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
if ((x < this->xmax && x >= xmin) && (y < ymax && y >= ymin)) {
inputOperation->read(color, x, y, sampler, inputBuffers);
}
@@ -79,10 +85,12 @@ void CropOperation::executePixel(float *color, float x, float y, PixelSampler sa
}
}
-CropImageOperation::CropImageOperation() :CropBaseOperation() {
+CropImageOperation::CropImageOperation() :CropBaseOperation()
+{
}
-bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
+bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+{
rcti newInput;
newInput.xmax = input->xmax + this->xmin;
@@ -93,13 +101,15 @@ bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
-void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[]) {
+void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[])
+{
NodeOperation::determineResolution(resolution, preferedResolution);
updateArea();
resolution[0] = this->xmax - this->xmin;
resolution[1] = this->ymax - this->ymin;
}
-void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
this->inputOperation->read(color, (x + this->xmin), (y + this->ymin), sampler, inputBuffers);
}