From 5335d36efe2ec34b99cf1d6fa65c0c4c2a5d199b Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 4 Feb 2008 18:41:06 +0000 Subject: [PATCH] Added some comments. Fixed a crash when composite-blending a pastecanvas onto an empty canvas. git-svn-id: http://svn.voria.com/code@1579 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/layer_pastecanvas.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp index edc3d0b..e632f26 100644 --- a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp +++ b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp @@ -343,14 +343,21 @@ Layer_PasteCanvas::accelerated_render(Context context,Surface *surface,int quali const Rect full_bounding_rect(canvas->get_context().get_full_bounding_rect()); bool blend_using_straight = false; // use 'straight' just for the central blit + // we have rendered what's under us, if necessary if(context->empty()) { + // if there's nothing under us, and we're blending 'onto', then we've finished if (Color::is_onto(blend_method)) return true; - if (blend_method==Color::BLEND_COMPOSITE) blend_method=Color::BLEND_STRAIGHT; + + // there's nothing under us, so using straight blending is + // faster than and equivalent to using composite, but we don't + // want to blank the surrounding areas + if (blend_method==Color::BLEND_COMPOSITE) blend_using_straight = true; } if (!etl::intersect(context.get_full_bounding_rect(),full_bounding_rect+origin)) { + // if there's no intersection between the context and our surface, and we're rendering 'onto', then we're done if (Color::is_onto(blend_method)) return true; /* 'straight' is faster than 'composite' and has the same -- 2.7.4