diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/compositor/operations/COM_MaskOperation.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp index 5674582a21a..d2a4854efee 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cpp +++ b/source/blender/compositor/operations/COM_MaskOperation.cpp @@ -147,13 +147,15 @@ void MaskOperation::initExecution() { initMutex(); - if (this->m_rasterMaskHandle == NULL) { - const int width = this->getWidth(); - const int height = this->getHeight(); + if (this->m_mask) { + if (this->m_rasterMaskHandle == NULL) { + const int width = this->getWidth(); + const int height = this->getHeight(); - this->m_rasterMaskHandle = BLI_maskrasterize_handle_new(); + this->m_rasterMaskHandle = BLI_maskrasterize_handle_new(); - BLI_maskrasterize_handle_init(this->m_rasterMaskHandle, this->m_mask, width, height, TRUE, this->m_do_smooth, this->m_do_feather); + BLI_maskrasterize_handle_init(this->m_rasterMaskHandle, this->m_mask, width, height, TRUE, this->m_do_smooth, this->m_do_feather); + } } } @@ -194,7 +196,12 @@ void MaskOperation::determineResolution(unsigned int resolution[], unsigned int void MaskOperation::executePixel(float *color, int x, int y, void *data) { const float xy[2] = {x / (float)this->m_maskWidth, y / (float)this->m_maskHeight}; - color[0] = BLI_maskrasterize_handle_sample(this->m_rasterMaskHandle, xy); + if (this->m_rasterMaskHandle) { + color[0] = BLI_maskrasterize_handle_sample(this->m_rasterMaskHandle, xy); + } + else { + color[0] = 0.0f; + } } #endif /* USE_RASKTER */ |