Commit 6a17172687cbcef081f2acb3e7257d2c9305c2aa

Alexei Podtelezhnikov 2015-03-17T22:43:08

Fix Savannah bug #44412 (part 2). * src/base/fttrigon.c (FT_Sin, FT_Cos, FT_Tan): Call `FT_Vector_Unit'.

diff --git a/ChangeLog b/ChangeLog
index 37e5e48..3b21ff6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-17  Alexei Podtelezhnikov <apodtele@gmail.com>
+
+	Fix Savannah bug #44412 (part 2).
+
+	* src/base/fttrigon.c (FT_Sin, FT_Cos, FT_Tan): Call `FT_Vector_Unit'.
+
 2015-03-11  Werner Lemberg  <wl@gnu.org>
 
 	[autofit] Add support for Arabic script.
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index a55920e..8972ba8 100644
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -299,11 +299,9 @@
     FT_Vector  v;
 
 
-    v.x = FT_TRIG_SCALE >> 8;
-    v.y = 0;
-    ft_trig_pseudo_rotate( &v, angle );
+    FT_Vector_Unit( &v, angle );
 
-    return ( v.x + 0x80L ) >> 8;
+    return v.x;
   }
 
 
@@ -312,7 +310,12 @@
   FT_EXPORT_DEF( FT_Fixed )
   FT_Sin( FT_Angle  angle )
   {
-    return FT_Cos( FT_ANGLE_PI2 - angle );
+    FT_Vector  v;
+
+
+    FT_Vector_Unit( &v, angle );
+
+    return v.y;
   }
 
 
@@ -324,9 +327,7 @@
     FT_Vector  v;
 
 
-    v.x = FT_TRIG_SCALE >> 8;
-    v.y = 0;
-    ft_trig_pseudo_rotate( &v, angle );
+    FT_Vector_Unit( &v, angle );
 
     return FT_DivFix( v.y, v.x );
   }