Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_GlareBaseOperation.cc
| Show All 15 Lines | |||||
| * Copyright 2011, Blender Foundation. | * Copyright 2011, Blender Foundation. | ||||
| */ | */ | ||||
| #include "COM_GlareBaseOperation.h" | #include "COM_GlareBaseOperation.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| namespace blender::compositor { | namespace blender::compositor { | ||||
| GlareBaseOperation::GlareBaseOperation() | GlareBaseOperation::GlareBaseOperation() : SingleThreadedOperation(DataType::Color) | ||||
| { | { | ||||
| this->addInputSocket(DataType::Color); | this->addInputSocket(DataType::Color); | ||||
| this->addOutputSocket(DataType::Color); | this->addOutputSocket(DataType::Color); | ||||
| this->m_settings = nullptr; | this->m_settings = nullptr; | ||||
| } | } | ||||
| void GlareBaseOperation::initExecution() | |||||
| { | |||||
| SingleThreadedOperation::initExecution(); | |||||
| this->m_inputProgram = getInputSocketReader(0); | |||||
| } | |||||
| void GlareBaseOperation::deinitExecution() | void GlareBaseOperation::update_memory_buffer(MemoryBuffer *output_buffer, | ||||
| rcti *output_rect, | |||||
| blender::Span<MemoryBuffer *> inputs) | |||||
| { | { | ||||
| this->m_inputProgram = nullptr; | MemoryBuffer *tile = inputs[0]; | ||||
| SingleThreadedOperation::deinitExecution(); | this->generateGlare(output_buffer->getBuffer(), tile, this->m_settings); | ||||
| } | } | ||||
| MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2) | void GlareBaseOperation::get_input_area_of_interest(int input_socket_index, | ||||
| const rcti *output_rect, | |||||
| rcti *r_input_area) | |||||
| { | { | ||||
| MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect2); | r_input_area->xmax = this->getWidth(); | ||||
| rcti rect; | r_input_area->xmin = 0; | ||||
| rect.xmin = 0; | r_input_area->ymax = this->getHeight(); | ||||
| rect.ymin = 0; | r_input_area->ymin = 0; | ||||
| rect.xmax = getWidth(); | |||||
| rect.ymax = getHeight(); | |||||
| MemoryBuffer *result = new MemoryBuffer(DataType::Color, rect); | |||||
| float *data = result->getBuffer(); | |||||
| this->generateGlare(data, tile, this->m_settings); | |||||
| return result; | |||||
| } | |||||
| bool GlareBaseOperation::determineDependingAreaOfInterest(rcti * /*input*/, | |||||
| ReadBufferOperation *readOperation, | |||||
| rcti *output) | |||||
| { | |||||
| if (isCached()) { | |||||
| return false; | |||||
| } | |||||
| rcti newInput; | |||||
| newInput.xmax = this->getWidth(); | |||||
| newInput.xmin = 0; | |||||
| newInput.ymax = this->getHeight(); | |||||
| newInput.ymin = 0; | |||||
| return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); | |||||
| } | } | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||