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:
authorJeroen Bakker <j.bakker@atmind.nl>2012-10-21 22:56:48 +0400
committerJeroen Bakker <j.bakker@atmind.nl>2012-10-21 22:56:48 +0400
commit4426e7bcb43a1d4d549a7a8175fe79ee63b40a09 (patch)
tree392988ecfb294c4495d60688a355cf2947acf460 /source/blender/compositor/operations/COM_CropOperation.cpp
parent248b2fc6d6f929ee5f8e5f5ad2ee073a9a995998 (diff)
Fix for [#32931] Crop node resets values to 0
Patch done by Markus Kasten Thanks for that!
Diffstat (limited to 'source/blender/compositor/operations/COM_CropOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index c33bd2544ac..24f28b2c98f 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -36,25 +36,29 @@ void CropBaseOperation::updateArea()
SocketReader *inputReference = this->getInputSocketReader(0);
float width = inputReference->getWidth();
float height = inputReference->getHeight();
- if (this->m_relative) {
- this->m_settings->x1 = width * this->m_settings->fac_x1;
- this->m_settings->x2 = width * this->m_settings->fac_x2;
- this->m_settings->y1 = height * this->m_settings->fac_y1;
- this->m_settings->y2 = height * this->m_settings->fac_y2;
- }
- if (width <= this->m_settings->x1 + 1)
- this->m_settings->x1 = width - 1;
- if (height <= this->m_settings->y1 + 1)
- this->m_settings->y1 = height - 1;
- if (width <= this->m_settings->x2 + 1)
- this->m_settings->x2 = width - 1;
- if (height <= this->m_settings->y2 + 1)
- this->m_settings->y2 = height - 1;
- this->m_xmax = MAX2(this->m_settings->x1, this->m_settings->x2) + 1;
- this->m_xmin = MIN2(this->m_settings->x1, this->m_settings->x2);
- this->m_ymax = MAX2(this->m_settings->y1, this->m_settings->y2) + 1;
- this->m_ymin = MIN2(this->m_settings->y1, this->m_settings->y2);
+ if (width > 0.0f && height > 0.0f)
+ {
+ if (this->m_relative) {
+ this->m_settings->x1 = width * this->m_settings->fac_x1;
+ this->m_settings->x2 = width * this->m_settings->fac_x2;
+ this->m_settings->y1 = height * this->m_settings->fac_y1;
+ this->m_settings->y2 = height * this->m_settings->fac_y2;
+ }
+ if (width <= this->m_settings->x1 + 1)
+ this->m_settings->x1 = width - 1;
+ if (height <= this->m_settings->y1 + 1)
+ this->m_settings->y1 = height - 1;
+ if (width <= this->m_settings->x2 + 1)
+ this->m_settings->x2 = width - 1;
+ if (height <= this->m_settings->y2 + 1)
+ this->m_settings->y2 = height - 1;
+
+ this->m_xmax = MAX2(this->m_settings->x1, this->m_settings->x2) + 1;
+ this->m_xmin = MIN2(this->m_settings->x1, this->m_settings->x2);
+ this->m_ymax = MAX2(this->m_settings->y1, this->m_settings->y2) + 1;
+ this->m_ymin = MIN2(this->m_settings->y1, this->m_settings->y2);
+ }
}
void CropBaseOperation::initExecution()