Avoid warnings from g++ 4.3.
[synfig.git] / synfig-core / trunk / src / synfig / context.cpp
index 024b6d8..9ac1020 100644 (file)
@@ -202,7 +202,7 @@ Context::accelerated_render(Surface *surface,int quality, const RendDesc &rendde
                if(layer_bounds.area() <= 0.0000000000001 || !(layer_bounds && bbox))
                {
                        if (composite &&
-                               composite->get_blend_method() == Color::BLEND_STRAIGHT &&
+                               Color::is_straight(composite->get_blend_method()) &&
                                composite->get_amount() != 0.0f)
                        {
                                straight_and_empty = true;
@@ -211,10 +211,13 @@ Context::accelerated_render(Surface *surface,int quality, const RendDesc &rendde
                        continue;
                }
 
-               // If this layer has Straight as the blend method and amount is 1.0
-               // then we don't want to render the context
-               if (composite && composite->get_blend_method() == Color::BLEND_STRAIGHT &&
-                       composite->get_amount() == 1.0f)
+               // If this layer has Straight as the blend method and amount
+               // is 1.0, and the layer doesn't depend on its context, then
+               // we don't want to render the context
+               if (composite &&
+                       composite->get_blend_method() == Color::BLEND_STRAIGHT &&
+                       composite->get_amount() == 1.0f &&
+                       !composite->reads_context())
                {
                        Layer::Handle layer = *context;
                        while (!context->empty()) context++; // skip the context
@@ -261,7 +264,7 @@ Context::accelerated_render(Surface *surface,int quality, const RendDesc &rendde
        // using the appropriate 'amount'
        if (straight_and_empty)
        {
-               if (ret = Context((context+1)).accelerated_render(surface,quality,renddesc,cb))
+               if ((ret = Context((context+1)).accelerated_render(surface,quality,renddesc,cb)))
                {
                        Surface clearsurface;
                        clearsurface.set_wh(renddesc.get_w(),renddesc.get_h());
@@ -269,7 +272,7 @@ Context::accelerated_render(Surface *surface,int quality, const RendDesc &rendde
 
                        Surface::alpha_pen apen(surface->begin());
                        apen.set_alpha(composite->get_amount());
-                       apen.set_blend_method(Color::BLEND_STRAIGHT);
+                       apen.set_blend_method(composite->get_blend_method());
 
                        clearsurface.blit_to(apen);
                }