Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / target_tile.cpp
index e16b09a..f02b71b 100644 (file)
@@ -51,7 +51,14 @@ using namespace synfig;
 const unsigned int     DEF_TILE_WIDTH = TILE_SIZE / 2;
 const unsigned int     DEF_TILE_HEIGHT= TILE_SIZE / 2;
 
+// note that if this isn't defined then the rendering is incorrect for
+// the straight blend method since the optimize_layers() function in
+// canvas.cpp which makes the straight blend method work correctly
+// isn't called.  ie. leave this defined.  to see the problem, draw a
+// small circle over a solid background.  set circle to amount 0.99
+// and blend method 'straight'.  the background should vanish but doesn't
 #define SYNFIG_OPTIMIZE_LAYER_TREE
+
 #ifdef _DEBUG
 // #define SYNFIG_DISPLAY_EFFICIENCY
 #endif
@@ -356,14 +363,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 +416,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;