diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-23 16:30:18 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-23 18:07:37 +0300 |
commit | 344aca3b1bf2718904455ea6cef1ffd8bedf51a6 (patch) | |
tree | e71d120e19ed64c1475250e226082c4325bfe2c1 /source/blender/compositor/operations/COM_FlipOperation.cc | |
parent | 064167fce70e3d7c382c374334a1bd0b520fe9fe (diff) |
Compositor: Full frame distort nodes
Adds full frame implementation to "Displace", "Crop", "Flip",
"Plane Track Deform", "Corner Pin", "Movie Distortion",
"Lens Distortion" and "Map UV" nodes.
The other nodes in "Distort" sub-menu are implemented
separately in other commits.
No functional changes.
Part of T88150.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D12166
Diffstat (limited to 'source/blender/compositor/operations/COM_FlipOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_FlipOperation.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_FlipOperation.cc b/source/blender/compositor/operations/COM_FlipOperation.cc index 8afbec4ddbe..d0dc6c0b570 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cc +++ b/source/blender/compositor/operations/COM_FlipOperation.cc @@ -75,4 +75,42 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } +void FlipOperation::get_area_of_interest(const int input_idx, + const rcti &output_area, + rcti &r_input_area) +{ + BLI_assert(input_idx == 0); + UNUSED_VARS_NDEBUG(input_idx); + if (this->m_flipX) { + const int w = (int)this->getWidth() - 1; + r_input_area.xmax = (w - output_area.xmin) + 1; + r_input_area.xmin = (w - output_area.xmax) - 1; + } + else { + r_input_area.xmin = output_area.xmin; + r_input_area.xmax = output_area.xmax; + } + if (this->m_flipY) { + const int h = (int)this->getHeight() - 1; + r_input_area.ymax = (h - output_area.ymin) + 1; + r_input_area.ymin = (h - output_area.ymax) - 1; + } + else { + r_input_area.ymin = output_area.ymin; + r_input_area.ymax = output_area.ymax; + } +} + +void FlipOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) +{ + const MemoryBuffer *input_img = inputs[0]; + for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { + const int nx = this->m_flipX ? ((int)this->getWidth() - 1) - it.x : it.x; + const int ny = this->m_flipY ? ((int)this->getHeight() - 1) - it.y : it.y; + input_img->read_elem(nx, ny, it.out); + } +} + } // namespace blender::compositor |