From: dooglus Date: Mon, 21 Jan 2008 01:10:29 +0000 (+0000) Subject: Rearranged a little. The functionality shouldn't have changed. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=7e79f447f0b72d717d21dc16b20a71b2e74198d6;p=synfig.git Rearranged a little. The functionality shouldn't have changed. git-svn-id: http://svn.voria.com/code@1406 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp index 06df545..b4b8538 100644 --- a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp +++ b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp @@ -298,20 +298,17 @@ Layer_PasteCanvas::accelerated_render(Context context,Surface *surface,int quali if(cb && !cb->amount_complete(0,10000)) return false; if(depth==MAX_DEPTH) - { // if we are at the extent of our depth, // then we should just return whatever is under us. return context.accelerated_render(surface,quality,renddesc,cb); - } + depth_counter counter(depth); if(!canvas || !get_amount()) return context.accelerated_render(surface,quality,renddesc,cb); if(muck_with_time_ && curr_time!=Time::begin() && canvas->get_time()!=curr_time+time_offset) - { canvas->set_time(curr_time+time_offset); - } SuperCallback stageone(cb,0,4500,10000); SuperCallback stagetwo(cb,4500,9000,10000); @@ -324,93 +321,64 @@ Layer_PasteCanvas::accelerated_render(Context context,Surface *surface,int quali desc.set_br((desc.get_br()-canvas->rend_desc().get_focus()-origin)*zoomfactor+canvas->rend_desc().get_focus()); desc.set_flags(RendDesc::PX_ASPECT); - if(is_solid_color() || context->empty()) + if (is_solid_color() || context->empty()) { surface->set_wh(renddesc.get_w(),renddesc.get_h()); surface->clear(); } - else if(!context.accelerated_render(surface,quality,renddesc,&stageone)) + else if (!context.accelerated_render(surface,quality,renddesc,&stageone)) return false; - Color::BlendMethod blend_method(get_blend_method()); + Color::BlendMethod blend_method(get_blend_method()); const Rect full_bounding_rect(canvas->get_context().get_full_bounding_rect()); - if(context->empty()) + if(context->empty() || + !etl::intersect(context.get_full_bounding_rect(),full_bounding_rect+origin)) { - if(Color::is_onto(blend_method)) - return true; - - if(blend_method==Color::BLEND_COMPOSITE) - blend_method=Color::BLEND_STRAIGHT; - } - else - if(!etl::intersect(context.get_full_bounding_rect(),full_bounding_rect+origin)) - { - if(Color::is_onto(blend_method)) - return true; - - if(blend_method==Color::BLEND_COMPOSITE) - blend_method=Color::BLEND_STRAIGHT; + if (Color::is_onto(blend_method)) return true; + if (blend_method==Color::BLEND_COMPOSITE) blend_method=Color::BLEND_STRAIGHT; } #ifdef SYNFIG_CLIP_PASTECANVAS - { - //synfig::info("PasteCanv Clip"); - Rect area(desc.get_rect()&full_bounding_rect); + Rect area(desc.get_rect() & full_bounding_rect); - Point min(area.get_min()); - Point max(area.get_max()); + Point min(area.get_min()); + Point max(area.get_max()); - if(desc.get_tl()[0]>desc.get_br()[0]) - swap(min[0],max[0]); - if(desc.get_tl()[1]>desc.get_br()[1]) - swap(min[1],max[1]); + if (desc.get_tl()[0] > desc.get_br()[0]) swap(min[0], max[0]); + if (desc.get_tl()[1] > desc.get_br()[1]) swap(min[1], max[1]); - const int - x(floor_to_int((min[0]-desc.get_tl()[0])/desc.get_pw())), - y(floor_to_int((min[1]-desc.get_tl()[1])/desc.get_ph())), - w(ceil_to_int((max[0]-desc.get_tl()[0])/desc.get_pw())-x), - h(ceil_to_int((max[1]-desc.get_tl()[1])/desc.get_ph())-y); + const int x(floor_to_int((min[0] - desc.get_tl()[0]) / desc.get_pw())); + const int y(floor_to_int((min[1] - desc.get_tl()[1]) / desc.get_ph())); + const int w( ceil_to_int((max[0] - desc.get_tl()[0]) / desc.get_pw()) - x); + const int h( ceil_to_int((max[1] - desc.get_tl()[1]) / desc.get_ph()) - y); - desc.set_subwindow(x,y,w,h); + desc.set_subwindow(x,y,w,h); - Surface pastesurface; - - // \todo this used to also have "area.area()<=0.000001 || " - is it useful? - // it was causing bug #1809480 (Zoom in beyond 8.75 in nested canvases fails) - if(desc.get_w()==0 || desc.get_h()==0) - { - if(cb && !cb->amount_complete(10000,10000)) return false; - - return true; - } - - if(!canvas->get_context().accelerated_render(&pastesurface,quality,desc,&stagetwo)) - return false; - - Surface::alpha_pen apen(surface->get_pen(x,y)); - - apen.set_alpha(get_amount()); - apen.set_blend_method(blend_method); - - pastesurface.blit_to(apen); - } -#else // SYNFIG_CLIP_PASTECANVAS + // \todo this used to also have "area.area()<=0.000001 || " - is it useful? + // it was causing bug #1809480 (Zoom in beyond 8.75 in nested canvases fails) + if(desc.get_w()==0 || desc.get_h()==0) { - Surface pastesurface; - - if(!canvas->get_context().accelerated_render(&pastesurface,quality,desc,&stagetwo)) - return false; - - Surface::alpha_pen apen(surface->begin()); + if(cb && !cb->amount_complete(10000,10000)) return false; + return true; + } +#endif // SYNFIG_CLIP_PASTECANVAS - apen.set_alpha(get_amount()); - apen.set_blend_method(blend_method); + // render the canvas to be pasted onto pastesurface + Surface pastesurface; + if(!canvas->get_context().accelerated_render(&pastesurface,quality,desc,&stagetwo)) + return false; - pastesurface.blit_to(apen); - } +#ifdef SYNFIG_CLIP_PASTECANVAS + Surface::alpha_pen apen(surface->get_pen(x,y)); +#else // SYNFIG_CLIP_PASTECANVAS + Surface::alpha_pen apen(surface->begin()); #endif // SYNFIG_CLIP_PASTECANVAS + apen.set_alpha(get_amount()); + apen.set_blend_method(blend_method); + pastesurface.blit_to(apen); + if(cb && !cb->amount_complete(10000,10000)) return false; return true;