From a5e6d73d412146cf9cdd077aec0b71cb615dd361 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 13 Jul 2012 12:55:30 +0000 Subject: fix for crash with new rasterizer --- .../compositor/operations/COM_MaskOperation.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'source/blender/compositor/operations/COM_MaskOperation.cpp') 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 */ -- cgit v1.2.3