Module: synfig/synfig
Branch: genete_width_outline
Commit: 13fe61c215dfed9dc0eb9af2762b89d326516903
URL:    
http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig/synfig;a=commit;h=13fe61c215dfed9dc0eb9af2762b89d326516903

Author: Carlos Lopez <[email protected]>
Date:   Sun Feb  6 12:02:17 2011 +0100

Fix normalised position member to handle properly negative values

---

 synfig-core/src/synfig/widthpoint.cpp |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/synfig-core/src/synfig/widthpoint.cpp 
b/synfig-core/src/synfig/widthpoint.cpp
index 6c1b741..6bb7748 100644
--- a/synfig-core/src/synfig/widthpoint.cpp
+++ b/synfig-core/src/synfig/widthpoint.cpp
@@ -72,10 +72,15 @@ WidthPoint::get_position()const
 Real
 WidthPoint::get_norm_position()const
 {
-       Real ret_pos(fabs(fmod(position_, Real(1.0f))));
-       if(fabs(position_) >= 1.0 && ret_pos==0.0)
-               return 1.0;
-       return ret_pos;
+       Real pos(get_position());
+       Real integer;
+       if(pos>=0.0 && pos <=1.0)
+               return pos;
+       else
+       {
+               Real ret(modf(pos, &integer));
+               return ret>=0.0?ret:(1.0+ret);
+       }
 }
 
 void


------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to