diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-09-28 20:33:06 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-09-28 23:00:17 +0300 |
commit | f84fb12f5d72433780a96c3cc4381399f153cf1a (patch) | |
tree | 62ca25765b3b5ccc2bc8ca35449ddd8f3999071a /source/blender/compositor/operations/COM_TextureOperation.cc | |
parent | 76377f0176b9561a7fc8f46b4ed704c631ddd90d (diff) |
Compositor: Add support for canvas compositing
This commit adds functionality for operations that require pixel
translation or resizing on "Full Frame" mode, allowing to adjust
their canvas. It fixes most cropping issues in translate, scale,
rotate and transform nodes by adjusting their canvas to the result,
instead of the input canvas.
Operations output buffer is still always on (0,0) position for
easier image algorithm implementation, even when the
canvas is not.
Current limitations (will be addressed on bcon2):
- Displayed translation in Viewer node is limited to 6000px.
- When scaling up the canvas size is limited to the
scene resolution size x 1.5 . From that point it crops.
If none of these limitations are hit, the Viewer node displays
the full input with any translation.
Differential Revision: https://developer.blender.org/D12466
Diffstat (limited to 'source/blender/compositor/operations/COM_TextureOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_TextureOperation.cc | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cc b/source/blender/compositor/operations/COM_TextureOperation.cc index 94977ed5adf..c06e3ac7cb0 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cc +++ b/source/blender/compositor/operations/COM_TextureOperation.cc @@ -74,26 +74,18 @@ void TextureBaseOperation::deinitExecution() void TextureBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { - switch (execution_model_) { - case eExecutionModel::Tiled: { - r_area = preferred_area; - if (BLI_rcti_is_empty(&preferred_area)) { - int width = this->m_rd->xsch * this->m_rd->size / 100; - int height = this->m_rd->ysch * this->m_rd->size / 100; - r_area.xmax = preferred_area.xmin + width; - r_area.ymax = preferred_area.ymin + height; - } - break; - } - case eExecutionModel::FullFrame: { - /* Determine inputs. */ - rcti temp; - NodeOperation::determine_canvas(preferred_area, temp); - - /* Don't use input areas, they are only used as parameters. */ - r_area = preferred_area; - break; - } + r_area = preferred_area; + if (BLI_rcti_is_empty(&preferred_area)) { + int width = this->m_rd->xsch * this->m_rd->size / 100; + int height = this->m_rd->ysch * this->m_rd->size / 100; + r_area.xmax = preferred_area.xmin + width; + r_area.ymax = preferred_area.ymin + height; + } + + if (execution_model_ == eExecutionModel::FullFrame) { + /* Determine inputs. */ + rcti temp; + NodeOperation::determine_canvas(r_area, temp); } } |