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->m_settings = nullptr; | this->m_settings = nullptr; | ||||
| } | } | ||||
| void GlareBaseOperation::initExecution() | void GlareBaseOperation::initExecution() | ||||
| { | { | ||||
| SingleThreadedOperation::initExecution(); | SingleThreadedOperation::initExecution(); | ||||
| this->m_inputProgram = getInputSocketReader(0); | this->m_inputProgram = getInputSocketReader(0); | ||||
| } | } | ||||
| void GlareBaseOperation::deinitExecution() | void GlareBaseOperation::deinitExecution() | ||||
| { | { | ||||
| this->m_inputProgram = nullptr; | this->m_inputProgram = nullptr; | ||||
| SingleThreadedOperation::deinitExecution(); | SingleThreadedOperation::deinitExecution(); | ||||
| } | } | ||||
| MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2) | void GlareBaseOperation::update_memory_buffer(MemoryBuffer *output_buffer, | ||||
| rcti *output_rect, | |||||
| blender::Span<MemoryBuffer *> inputs) | |||||
| { | { | ||||
| MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect2); | MemoryBuffer *tile = inputs[0]; | ||||
| rcti rect; | this->generateGlare(output_buffer->getBuffer(), tile, this->m_settings); | ||||
| rect.xmin = 0; | |||||
| rect.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*/, | bool GlareBaseOperation::determineDependingAreaOfInterest(rcti * /*input*/, | ||||
| ReadBufferOperation *readOperation, | ReadBufferOperation *readOperation, | ||||
| rcti *output) | rcti *output) | ||||
| { | { | ||||
| if (isCached()) { | |||||
| return false; | |||||
| } | |||||
| rcti newInput; | rcti newInput; | ||||
| newInput.xmax = this->getWidth(); | newInput.xmax = this->getWidth(); | ||||
| newInput.xmin = 0; | newInput.xmin = 0; | ||||
| newInput.ymax = this->getHeight(); | newInput.ymax = this->getHeight(); | ||||
| newInput.ymin = 0; | newInput.ymin = 0; | ||||
| return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); | return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); | ||||
| } | } | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||