Mask node: create a copy of layers to be rasterized in initExecution
[blender.git] / source / blender / compositor / operations / COM_MaskOperation.cpp
index aa16ecf5d098513f29969b70d67cdb8ed31e9d03..2b45cd53fd5dad01d17a4eb257955e0217329684 100644 (file)
@@ -49,11 +49,19 @@ MaskOperation::MaskOperation() : NodeOperation()
 void MaskOperation::initExecution()
 {
        initMutex();
+
        this->m_rasterizedMask = NULL;
+       this->m_maskLayers.first = this->m_maskLayers.last = NULL;
+
+       if (this->m_mask) {
+               BKE_mask_layer_copy_list(&this->m_maskLayers, &this->m_mask->masklayers);
+       }
 }
 
 void MaskOperation::deinitExecution()
 {
+       BKE_mask_layer_free_list(&this->m_maskLayers);
+
        if (this->m_rasterizedMask) {
                MEM_freeN(this->m_rasterizedMask);
                this->m_rasterizedMask = NULL;
@@ -75,7 +83,10 @@ void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers
                float *buffer;
 
                buffer = (float *)MEM_callocN(sizeof(float) * width * height, "rasterized mask");
-               BKE_mask_rasterize(this->m_mask, width, height, buffer, TRUE, this->m_do_smooth, this->m_do_feather);
+
+               BKE_mask_rasterize_layers(&this->m_maskLayers, width, height, buffer, TRUE,
+                                         this->m_do_smooth, this->m_do_feather);
+
                if (this->m_do_smooth) {
                        PLX_antialias_buffer(buffer, width, height);
                }