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:
authorManuel Castilla <manzanillawork@gmail.com>2021-07-13 22:29:45 +0300
committerManuel Castilla <manzanillawork@gmail.com>2021-07-13 23:34:28 +0300
commit538f452ea97f93daa158a479dfed2b7c3973ec06 (patch)
treec1ac452613ea0ce516b3e69e1be4df0f8fb007f4 /source/blender/compositor/operations/COM_TranslateOperation.cc
parent2ea47057d33ebfa4ef5dfe687adc66464430e8f8 (diff)
Compositor: Full frame Translate node
Adds full frame implementation to this node operation. No functional changes.
Diffstat (limited to 'source/blender/compositor/operations/COM_TranslateOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cc b/source/blender/compositor/operations/COM_TranslateOperation.cc
index d59196a19a0..a3db086e974 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.cc
+++ b/source/blender/compositor/operations/COM_TranslateOperation.cc
@@ -36,6 +36,8 @@ TranslateOperation::TranslateOperation(DataType data_type)
this->m_isDeltaSet = false;
this->m_factorX = 1.0f;
this->m_factorY = 1.0f;
+ this->x_extend_mode_ = MemoryBufferExtend::Clip;
+ this->y_extend_mode_ = MemoryBufferExtend::Clip;
}
void TranslateOperation::initExecution()
{
@@ -86,4 +88,58 @@ void TranslateOperation::setFactorXY(float factorX, float factorY)
m_factorY = factorY;
}
+void TranslateOperation::set_wrapping(int wrapping_type)
+{
+ switch (wrapping_type) {
+ case CMP_NODE_WRAP_X:
+ x_extend_mode_ = MemoryBufferExtend::Repeat;
+ break;
+ case CMP_NODE_WRAP_Y:
+ y_extend_mode_ = MemoryBufferExtend::Repeat;
+ break;
+ case CMP_NODE_WRAP_XY:
+ x_extend_mode_ = MemoryBufferExtend::Repeat;
+ y_extend_mode_ = MemoryBufferExtend::Repeat;
+ break;
+ default:
+ break;
+ }
+}
+
+void TranslateOperation::get_area_of_interest(const int input_idx,
+ const rcti &output_area,
+ rcti &r_input_area)
+{
+ if (input_idx == 0) {
+ ensureDelta();
+ r_input_area = output_area;
+ if (x_extend_mode_ == MemoryBufferExtend::Clip) {
+ const int delta_x = this->getDeltaX();
+ BLI_rcti_translate(&r_input_area, -delta_x, 0);
+ }
+ if (y_extend_mode_ == MemoryBufferExtend::Clip) {
+ const int delta_y = this->getDeltaY();
+ BLI_rcti_translate(&r_input_area, 0, -delta_y);
+ }
+ }
+}
+
+void TranslateOperation::update_memory_buffer_partial(MemoryBuffer *output,
+ const rcti &area,
+ Span<MemoryBuffer *> inputs)
+{
+ MemoryBuffer *input = inputs[0];
+ const int delta_x = this->getDeltaX();
+ const int delta_y = this->getDeltaY();
+ for (int y = area.ymin; y < area.ymax; y++) {
+ float *out = output->get_elem(area.xmin, y);
+ for (int x = area.xmin; x < area.xmax; x++) {
+ const int input_x = x - delta_x;
+ const int input_y = y - delta_y;
+ input->read(out, input_x, input_y, x_extend_mode_, y_extend_mode_);
+ out += output->elem_stride;
+ }
+ }
+}
+
} // namespace blender::compositor