From: dooglus Date: Wed, 23 Jan 2008 20:23:57 +0000 (+0000) Subject: Use Color::is_straight(). Also, re-enable the optimization for straight blending... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2dc2a206a800705cce91751de1ec3127c2ac2397;p=synfig.git Use Color::is_straight(). Also, re-enable the optimization for straight blending when amount==1, but only for layers which don't need to see their context. git-svn-id: http://svn.voria.com/code@1438 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/context.cpp b/synfig-core/trunk/src/synfig/context.cpp index 3bd36b7..d16c06b 100644 --- a/synfig-core/trunk/src/synfig/context.cpp +++ b/synfig-core/trunk/src/synfig/context.cpp @@ -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,18 +211,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 && + Color::is_straight(composite->get_blend_method()) && + 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;