X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_gradient%2Fcurvegradient.cpp;h=ee7a4b27f1baf44b67caa82b12809ecd19368979;hb=13468222677bf3e31d445144621d983a4094c6bb;hp=508a46487431ca9d465ec4f1fdfa4f8811f7f855;hpb=2ab94d47c09e4afe46209e87e8251e197c1f5b93;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_gradient/curvegradient.cpp b/synfig-core/trunk/src/modules/mod_gradient/curvegradient.cpp index 508a464..ee7a4b2 100644 --- a/synfig-core/trunk/src/modules/mod_gradient/curvegradient.cpp +++ b/synfig-core/trunk/src/modules/mod_gradient/curvegradient.cpp @@ -1,11 +1,12 @@ /* === S Y N F I G ========================================================= */ /*! \file curvegradient.cpp -** \brief Template Header +** \brief Implementation of the "Curve Gradient" layer ** ** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 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 @@ -53,8 +54,8 @@ SYNFIG_LAYER_INIT(CurveGradient); SYNFIG_LAYER_SET_NAME(CurveGradient,"curve_gradient"); -SYNFIG_LAYER_SET_LOCAL_NAME(CurveGradient,_("Curve Gradient")); -SYNFIG_LAYER_SET_CATEGORY(CurveGradient,_("Gradients")); +SYNFIG_LAYER_SET_LOCAL_NAME(CurveGradient,N_("Curve Gradient")); +SYNFIG_LAYER_SET_CATEGORY(CurveGradient,N_("Gradients")); SYNFIG_LAYER_SET_VERSION(CurveGradient,"0.0"); SYNFIG_LAYER_SET_CVS_ID(CurveGradient,"$Id$"); @@ -72,7 +73,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 +84,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 +198,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); }