Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_SplitOperation.cc
| Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | void SplitOperation::executePixelSampled(float output[4], | ||||
| if (image1) { | if (image1) { | ||||
| this->m_image1Input->readSampled(output, x, y, PixelSampler::Nearest); | this->m_image1Input->readSampled(output, x, y, PixelSampler::Nearest); | ||||
| } | } | ||||
| else { | else { | ||||
| this->m_image2Input->readSampled(output, x, y, PixelSampler::Nearest); | this->m_image2Input->readSampled(output, x, y, PixelSampler::Nearest); | ||||
| } | } | ||||
| } | } | ||||
| void SplitOperation::determineResolution(unsigned int resolution[2], | void SplitOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) | ||||
| unsigned int preferredResolution[2]) | |||||
| { | { | ||||
| unsigned int tempPreferredResolution[2] = {0, 0}; | rcti unused_area; | ||||
| unsigned int tempResolution[2]; | |||||
| this->getInputSocket(0)->determineResolution(tempResolution, tempPreferredResolution); | const bool determined = this->getInputSocket(0)->determine_canvas(COM_AREA_NONE, unused_area); | ||||
| this->setResolutionInputSocketIndex((tempResolution[0] && tempResolution[1]) ? 0 : 1); | this->set_canvas_input_index(determined ? 0 : 1); | ||||
| NodeOperation::determineResolution(resolution, preferredResolution); | NodeOperation::determine_canvas(preferred_area, r_area); | ||||
| } | } | ||||
| void SplitOperation::update_memory_buffer_partial(MemoryBuffer *output, | void SplitOperation::update_memory_buffer_partial(MemoryBuffer *output, | ||||
| const rcti &area, | const rcti &area, | ||||
| Span<MemoryBuffer *> inputs) | Span<MemoryBuffer *> inputs) | ||||
| { | { | ||||
| const int percent = this->m_xSplit ? this->m_splitPercentage * this->getWidth() / 100.0f : | const int percent = this->m_xSplit ? this->m_splitPercentage * this->getWidth() / 100.0f : | ||||
| this->m_splitPercentage * this->getHeight() / 100.0f; | this->m_splitPercentage * this->getHeight() / 100.0f; | ||||
| const size_t elem_bytes = COM_data_type_bytes_len(getOutputSocket()->getDataType()); | const size_t elem_bytes = COM_data_type_bytes_len(getOutputSocket()->getDataType()); | ||||
| for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { | 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 = this->m_xSplit ? it.x > percent : it.y > percent; | ||||
| memcpy(it.out, it.in(is_image1 ? 0 : 1), elem_bytes); | memcpy(it.out, it.in(is_image1 ? 0 : 1), elem_bytes); | ||||
| } | } | ||||
| } | } | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||