Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/intern/COM_FullFrameOperation.cc
- This file was added.
| /* | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License | |||||
| * as published by the Free Software Foundation; either version 2 | |||||
| * of the License, or (at your option) any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * You should have received a copy of the GNU General Public License | |||||
| * along with this program; if not, write to the Free Software Foundation, | |||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||||
| * | |||||
| * Copyright 2011, Blender Foundation. | |||||
| */ | |||||
| #include "COM_FullFrameOperation.h" | |||||
| namespace blender::compositor { | |||||
| void FullFrameOperation::execute_write_buffer_region(WriteBufferOperation *write_buffer_op, | |||||
| rcti *rect) | |||||
| { | |||||
| blender::Vector<MemoryBuffer *> input_bufs = get_input_buffers(write_buffer_op, rect); | |||||
| MemoryBuffer *memory_buffer = write_buffer_op->getMemoryProxy()->getBuffer(); | |||||
| update_memory_buffer(memory_buffer, rect, input_bufs); | |||||
| } | |||||
| void FullFrameOperation::execute_output_region(NodeOperation *output_op, rcti *rect) | |||||
| { | |||||
| BLI_assert(output_op->getNumberOfOutputSockets() == 0); | |||||
| blender::Vector<MemoryBuffer *> input_bufs = get_input_buffers(output_op, rect); | |||||
| update_memory_buffer(nullptr, rect, input_bufs); | |||||
| } | |||||
| void FullFrameOperation::get_input_area_of_interest(int input_index, | |||||
| const rcti *output_rect, | |||||
| rcti *r_input_area) | |||||
| { | |||||
| *r_input_area = *output_rect; | |||||
| } | |||||
| blender::Vector<MemoryBuffer *> FullFrameOperation::get_input_buffers(NodeOperation *operation, | |||||
| const rcti *output_rect) | |||||
| { | |||||
| int n_inputs = operation->getNumberOfInputSockets(); | |||||
| blender::Vector<MemoryBuffer *> input_bufs; | |||||
| rcti input_area; | |||||
| for (int input_idx = 0; input_idx < n_inputs; input_idx++) { | |||||
| NodeOperationInput *input_socket = operation->getInputSocket(input_idx); | |||||
| if (input_socket->isConnected()) { | |||||
| get_input_area_of_interest(input_idx, output_rect, &input_area); | |||||
| NodeOperation &input_op = input_socket->getLink()->getOperation(); | |||||
| MemoryBuffer *input_buf = (MemoryBuffer *)input_op.initializeTileData(&input_area); | |||||
| input_bufs.append(input_buf); | |||||
| } | |||||
| else { | |||||
| input_bufs.append(nullptr); | |||||
| } | |||||
| } | |||||
| return input_bufs; | |||||
| } | |||||
| } // namespace blender::compositor | |||||