From: dooglus Date: Thu, 13 Sep 2007 12:44:31 +0000 (+0000) Subject: When a curve gradient layer's bline is looped and perpendicular is checked, spread... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=44181644c51eb7b5755e0a1459a6ef04483f88c5;p=synfig.git When a curve gradient layer's bline is looped and perpendicular is checked, spread the gradient over the entire loop. Previously the last bline wasn't used. git-svn-id: http://svn.voria.com/code@663 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/modules/mod_gradient/curvegradient.cpp b/synfig-core/trunk/src/modules/mod_gradient/curvegradient.cpp index 508a464..9f2c42a 100644 --- a/synfig-core/trunk/src/modules/mod_gradient/curvegradient.cpp +++ b/synfig-core/trunk/src/modules/mod_gradient/curvegradient.cpp @@ -72,7 +72,7 @@ inline float calculate_distance(const synfig::BLinePoint& a,const synfig::BLineP #endif } -inline float calculate_distance(const std::vector& bline) +inline float calculate_distance(const std::vector& bline, bool bline_loop) { std::vector::const_iterator iter,next,ret; std::vector::const_iterator end(bline.end()); @@ -83,10 +83,10 @@ inline float calculate_distance(const std::vector& bline) next=bline.begin(); - //if(loop) - // iter=--bline.end(); - //else - iter=next++; + if(bline_loop) + iter=--bline.end(); + else + iter=next++; for(;next!=end;iter=next++) { @@ -197,7 +197,7 @@ find_closest(bool fast, const std::vector& bline,const Point inline void CurveGradient::sync() { - curve_length_=calculate_distance(bline); + curve_length_=calculate_distance(bline, bline_loop); }