Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/intern/COM_SingleThreadedOperation.cc
| Show All 14 Lines | |||||
| * | * | ||||
| * Copyright 2011, Blender Foundation. | * Copyright 2011, Blender Foundation. | ||||
| */ | */ | ||||
| #include "COM_SingleThreadedOperation.h" | #include "COM_SingleThreadedOperation.h" | ||||
| namespace blender::compositor { | namespace blender::compositor { | ||||
| SingleThreadedOperation::SingleThreadedOperation() | SingleThreadedOperation::SingleThreadedOperation(DataType data_type) | ||||
| : WriteBufferOperation(data_type, false) | |||||
| { | { | ||||
| this->m_cachedInstance = nullptr; | addOutputSocket(data_type); | ||||
| flags.complex = true; | flags.complex = true; | ||||
| flags.single_threaded = true; | flags.write_full_buffer = true; | ||||
| } | } | ||||
| void SingleThreadedOperation::initExecution() | void SingleThreadedOperation::executeRegion(rcti *rect, unsigned int UNUSED(tile_number)) | ||||
| { | { | ||||
| initMutex(); | execute_write_buffer_region(this, rect); | ||||
| } | |||||
| void SingleThreadedOperation::executePixel(float output[4], int x, int y, void * /*data*/) | |||||
| { | |||||
| this->m_cachedInstance->readNoCheck(output, x, y); | |||||
| } | |||||
| void SingleThreadedOperation::deinitExecution() | |||||
| { | |||||
| deinitMutex(); | |||||
| if (this->m_cachedInstance) { | |||||
| delete this->m_cachedInstance; | |||||
| this->m_cachedInstance = nullptr; | |||||
| } | |||||
| } | |||||
| void *SingleThreadedOperation::initializeTileData(rcti *rect) | |||||
| { | |||||
| if (this->m_cachedInstance) { | |||||
| return this->m_cachedInstance; | |||||
| } | |||||
| lockMutex(); | |||||
| if (this->m_cachedInstance == nullptr) { | |||||
| // | |||||
| this->m_cachedInstance = createMemoryBuffer(rect); | |||||
| } | |||||
| unlockMutex(); | |||||
| return this->m_cachedInstance; | |||||
| } | } | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||