Declare the paste_canvas pointing in the block that uses it to limit its scope.
[synfig.git] / synfig-core / trunk / src / synfig / canvas.cpp
index 59d54af..24760ab 100644 (file)
@@ -1082,12 +1082,12 @@ synfig::optimize_layers(Context context, Canvas::Handle op_canvas, bool seen_mot
                if(value.get_type()==ValueBase::TYPE_REAL && value.get(Real())==0)
                        continue;
 
-               Layer_PasteCanvas* paste_canvas(static_cast<Layer_PasteCanvas*>(layer.get()));
-
                // note: this used to include "&& paste_canvas->get_time_offset()==0", but then
                //               time-shifted layers weren't being sorted by z-depth (bug #1806852)
                if(layer->get_name()=="PasteCanvas")
                {
+                       Layer_PasteCanvas* paste_canvas(static_cast<Layer_PasteCanvas*>(layer.get()));
+
                        // we need to blur the sub canvas if:
                        // our parent is blurred,
                        // or the child is lower than a local blur,
@@ -1113,8 +1113,9 @@ synfig::optimize_layers(Context context, Canvas::Handle op_canvas, bool seen_mot
                        Canvas::Handle paste_sub_canvas = paste_canvas->get_sub_canvas();
                        if(paste_sub_canvas)
                                optimize_layers(paste_sub_canvas->get_context(),sub_canvas,motion_blurred);
-//#define SYNFIG_OPTIMIZE_PASTE_CANVAS 1
 
+// \todo: uncommenting the following breaks the rendering of at least examples/backdrop.sifz quite severely
+// #define SYNFIG_OPTIMIZE_PASTE_CANVAS
 #ifdef SYNFIG_OPTIMIZE_PASTE_CANVAS
                        Canvas::iterator sub_iter;