Make the layer optimization optional at runtime using the SYNFIG_DISABLE_OPTIMIZE_LAY...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 29 Feb 2008 15:36:18 +0000 (15:36 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 29 Feb 2008 15:36:18 +0000 (15:36 +0000)
git-svn-id: http://svn.voria.com/code@1825 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/target_scanline.cpp
synfig-core/trunk/src/synfig/target_tile.cpp

index e43da30..49cff08 100644 (file)
@@ -172,14 +172,20 @@ synfig::Target_Scanline::render(ProgressCallback *cb)
 
                Context context;
 
-               #ifdef SYNFIG_OPTIMIZE_LAYER_TREE
-               Canvas::Handle op_canvas(Canvas::create());
-               op_canvas->set_file_name(canvas->get_file_name());
-               optimize_layers(canvas->get_time(), canvas->get_context(), op_canvas);
-               context=op_canvas->get_context();
-               #else
+#ifdef SYNFIG_OPTIMIZE_LAYER_TREE
+               Canvas::Handle op_canvas;
+               if (!getenv("SYNFIG_DISABLE_OPTIMIZE_LAYER_TREE"))
+               {
+                       op_canvas = Canvas::create();
+                       op_canvas->set_file_name(canvas->get_file_name());
+                       optimize_layers(canvas->get_time(), canvas->get_context(), op_canvas);
+                       context=op_canvas->get_context();
+               }
+               else
+                       context=canvas->get_context();
+#else
                context=canvas->get_context();
-               #endif
+#endif
 
                // If the quality is set to zero, then we
                // use the parametric scanline-renderer.
@@ -307,14 +313,20 @@ synfig::Target_Scanline::render(ProgressCallback *cb)
                        canvas->set_time(t);
                Context context;
 
-               #ifdef SYNFIG_OPTIMIZE_LAYER_TREE
-               Canvas::Handle op_canvas(Canvas::create());
-               op_canvas->set_file_name(canvas->get_file_name());
-               optimize_layers(canvas->get_time(), canvas->get_context(), op_canvas);
-               context=op_canvas->get_context();
-               #else
+#ifdef SYNFIG_OPTIMIZE_LAYER_TREE
+               Canvas::Handle op_canvas;
+               if (!getenv("SYNFIG_DISABLE_OPTIMIZE_LAYER_TREE"))
+               {
+                       op_canvas = Canvas::create();
+                       op_canvas->set_file_name(canvas->get_file_name());
+                       optimize_layers(canvas->get_time(), canvas->get_context(), op_canvas);
+                       context=op_canvas->get_context();
+               }
+               else
+                       context=canvas->get_context();
+#else
                context=canvas->get_context();
-               #endif
+#endif
 
                // If the quality is set to zero, then we
                // use the parametric scanline-renderer.
index e16b09a..ef81d5a 100644 (file)
@@ -356,14 +356,20 @@ synfig::Target_Tile::render(ProgressCallback *cb)
 
                        Context context;
 
-                       #ifdef SYNFIG_OPTIMIZE_LAYER_TREE
-                       Canvas::Handle op_canvas(Canvas::create());
-                       op_canvas->set_file_name(canvas->get_file_name());
-                       optimize_layers(canvas->get_time(), canvas->get_context(), op_canvas);
-                       context=op_canvas->get_context();
-                       #else
+#ifdef SYNFIG_OPTIMIZE_LAYER_TREE
+                       Canvas::Handle op_canvas;
+                       if (!getenv("SYNFIG_DISABLE_OPTIMIZE_LAYER_TREE"))
+                       {
+                               op_canvas = Canvas::create();
+                               op_canvas->set_file_name(canvas->get_file_name());
+                               optimize_layers(canvas->get_time(), canvas->get_context(), op_canvas);
+                               context=op_canvas->get_context();
+                       }
+                       else
+                               context=canvas->get_context();
+#else
                        context=canvas->get_context();
-                       #endif
+#endif
 
 /*
                        #ifdef SYNFIG_OPTIMIZE_LAYER_TREE
@@ -403,14 +409,20 @@ synfig::Target_Tile::render(ProgressCallback *cb)
 
                        Context context;
 
-                       #ifdef SYNFIG_OPTIMIZE_LAYER_TREE
-                       Canvas::Handle op_canvas(Canvas::create());
-                       op_canvas->set_file_name(canvas->get_file_name());
-                       optimize_layers(canvas->get_time(), canvas->get_context(), op_canvas);
-                       context=op_canvas->get_context();
-                       #else
+#ifdef SYNFIG_OPTIMIZE_LAYER_TREE
+                       Canvas::Handle op_canvas;
+                       if (!getenv("SYNFIG_DISABLE_OPTIMIZE_LAYER_TREE"))
+                       {
+                               op_canvas = Canvas::create();
+                               op_canvas->set_file_name(canvas->get_file_name());
+                               optimize_layers(canvas->get_time(), canvas->get_context(), op_canvas);
+                               context=op_canvas->get_context();
+                       }
+                       else
+                               context=canvas->get_context();
+#else
                        context=canvas->get_context();
-                       #endif
+#endif
 
                        if(!render_frame_(context, cb))
                                return false;