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-06-15 11:50:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-15 11:50:27 +0400
commit46ea5670db378048fc1339b5e355523842fa82a2 (patch)
tree45124626abbb8d43fce2e3f0f89b9067590a3def /source/blender/compositor/operations/COM_ScaleOperation.cpp
parente879ee1798151301765bcdf6b2e6c67718a782a8 (diff)
scale node - framing offset: compatible with camera shiftX/Y and the viewport option.
Diffstat (limited to 'source/blender/compositor/operations/COM_ScaleOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp
index aea4da920a0..45e846998af 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp
@@ -191,6 +191,21 @@ void ScaleFixedSizeOperation::initExecution()
this->relX = inputOperation->getWidth() / (float)this->newWidth;
this->relY = inputOperation->getHeight() / (float)this->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->newWidth > this->newHeight) {
+ this->offsetX *= this->newWidth;
+ this->offsetY *= this->newWidth;
+ }
+ else {
+ this->offsetX *= this->newHeight;
+ this->offsetY *= this->newHeight;
+ }
+ }
+
if (this->is_aspect) {
/* apply aspect from clip */
const float w_src = inputOperation->getWidth();
@@ -203,9 +218,6 @@ void ScaleFixedSizeOperation::initExecution()
const float asp_src = w_src / h_src;
const float asp_dst = w_dst / h_dst;
- this->offsetX = 0.0f;
- this->offsetY = 0.0f;
-
if (fabsf(asp_src - asp_dst) >= FLT_EPSILON) {
if ((asp_src > asp_dst) == (this->is_crop == true)) {
/* fit X */
@@ -219,9 +231,11 @@ void ScaleFixedSizeOperation::initExecution()
this->relY /= div;
this->offsetY = ((h_src - (h_src * div)) / (h_src / h_dst)) / 2.0f;
}
- }
+ this->is_offset = true;
+ }
}
+ /* *** end framing options *** */
}
void ScaleFixedSizeOperation::deinitExecution()
@@ -236,7 +250,7 @@ void ScaleFixedSizeOperation::executePixel(float *color, float x, float y, Pixel
sampler = COM_PS_BICUBIC;
#endif
- if (this->is_aspect) {
+ if (this->is_offset) {
float nx = ((x - this->offsetX) * relX);
float ny = ((y - this->offsetY) * relY);
this->inputOperation->read(color, nx, ny, sampler, inputBuffers);