diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_SplitOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_SplitOperation.cc | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/source/blender/compositor/operations/COM_SplitOperation.cc b/source/blender/compositor/operations/COM_SplitOperation.cc index 47b2bbb7e94..39d097b02e1 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.cc +++ b/source/blender/compositor/operations/COM_SplitOperation.cc @@ -17,61 +17,52 @@ */ #include "COM_SplitOperation.h" -#include "BKE_image.h" -#include "BLI_listbase.h" -#include "BLI_math_color.h" -#include "BLI_math_vector.h" -#include "BLI_utildefines.h" -#include "MEM_guardedalloc.h" - -#include "IMB_imbuf.h" -#include "IMB_imbuf_types.h" namespace blender::compositor { SplitOperation::SplitOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); - this->m_image1Input = nullptr; - this->m_image2Input = nullptr; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + image1Input_ = nullptr; + image2Input_ = nullptr; } -void SplitOperation::initExecution() +void SplitOperation::init_execution() { /* When initializing the tree during initial load the width and height can be zero. */ - this->m_image1Input = getInputSocketReader(0); - this->m_image2Input = getInputSocketReader(1); + image1Input_ = get_input_socket_reader(0); + image2Input_ = get_input_socket_reader(1); } -void SplitOperation::deinitExecution() +void SplitOperation::deinit_execution() { - this->m_image1Input = nullptr; - this->m_image2Input = nullptr; + image1Input_ = nullptr; + image2Input_ = nullptr; } -void SplitOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void SplitOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { - int perc = this->m_xSplit ? this->m_splitPercentage * this->getWidth() / 100.0f : - this->m_splitPercentage * this->getHeight() / 100.0f; - bool image1 = this->m_xSplit ? x > perc : y > perc; + int perc = x_split_ ? split_percentage_ * this->get_width() / 100.0f : + split_percentage_ * this->get_height() / 100.0f; + bool image1 = x_split_ ? x > perc : y > perc; if (image1) { - this->m_image1Input->readSampled(output, x, y, PixelSampler::Nearest); + image1Input_->read_sampled(output, x, y, PixelSampler::Nearest); } else { - this->m_image2Input->readSampled(output, x, y, PixelSampler::Nearest); + image2Input_->read_sampled(output, x, y, PixelSampler::Nearest); } } void SplitOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { - rcti unused_area; + rcti unused_area = COM_AREA_NONE; - const bool determined = this->getInputSocket(0)->determine_canvas(COM_AREA_NONE, unused_area); + const bool determined = this->get_input_socket(0)->determine_canvas(COM_AREA_NONE, unused_area); this->set_canvas_input_index(determined ? 0 : 1); NodeOperation::determine_canvas(preferred_area, r_area); @@ -81,11 +72,11 @@ void SplitOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - const int percent = this->m_xSplit ? this->m_splitPercentage * this->getWidth() / 100.0f : - this->m_splitPercentage * this->getHeight() / 100.0f; - const size_t elem_bytes = COM_data_type_bytes_len(getOutputSocket()->getDataType()); + const int percent = x_split_ ? split_percentage_ * this->get_width() / 100.0f : + split_percentage_ * this->get_height() / 100.0f; + const size_t elem_bytes = COM_data_type_bytes_len(get_output_socket()->get_data_type()); for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { - const bool is_image1 = this->m_xSplit ? it.x > percent : it.y > percent; + const bool is_image1 = x_split_ ? it.x > percent : it.y > percent; memcpy(it.out, it.in(is_image1 ? 0 : 1), elem_bytes); } } |