X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fcontext.cpp;h=38e0f671684321f872798f77cc8c1f1d9872c545;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=3bd36b7ead718ba24cb4b5cceea7f810b861a59e;hpb=2147b77cbf12e45a2f956240bffbda9b45fb354c;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/context.cpp b/synfig-core/trunk/src/synfig/context.cpp index 3bd36b7..38e0f67 100644 --- a/synfig-core/trunk/src/synfig/context.cpp +++ b/synfig-core/trunk/src/synfig/context.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2008 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -202,7 +203,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,18 +212,18 @@ Context::accelerated_render(Surface *surface,int quality, const RendDesc &rendde continue; } -// the following breaks the blur layer when used with the straight blend method -// in that case we do want to render the context, to know what to blur -// -// // 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) -// { -// Layer::Handle layer = *context; -// while (!context->empty()) context++; // skip the context -// return layer->accelerated_render(context,surface,quality,renddesc, cb); -// } + // 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 + return layer->accelerated_render(context,surface,quality,renddesc, cb); + } // Break out of the loop--we have found a good layer break; @@ -264,7 +265,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()); @@ -272,7 +273,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); } @@ -319,9 +320,13 @@ Context::set_time(Time time)const Context context(*this); while(!(context)->empty()) { - // If this layer is active, then go - // ahead and break out of the loop - if((*context)->active() && !(*context)->dirty_time_.is_equal(time)) + // If this layer is active, and + // it either isn't already set to the given time or + // it's a time loop layer, + // then break out of the loop and set its time + if((*context)->active() && + (!(*context)->dirty_time_.is_equal(time) || + (*context)->get_name() == "timeloop")) break; // Otherwise, we want to keep searching