Commit 2d7284e962b5fe93c8f5c95768239d7480e50d28

Alexei Podtelezhnikov 2015-03-20T21:34:19

* src/base/fttrigon.c (FT_Vector_Rotate): Minor refactoring.

diff --git a/ChangeLog b/ChangeLog
index 3b21ff6..2185d92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-20  Alexei Podtelezhnikov <apodtele@gmail.com>
+
+	* src/base/fttrigon.c (FT_Vector_Rotate): Minor refactoring.
+
 2015-03-17  Alexei Podtelezhnikov <apodtele@gmail.com>
 
 	Fix Savannah bug #44412 (part 2).
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index 8972ba8..4255245 100644
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -389,33 +389,32 @@
     FT_Vector  v;
 
 
-    if ( !vec )
+    if ( !vec || !angle )
       return;
 
-    v.x   = vec->x;
-    v.y   = vec->y;
+    v = *vec;
 
-    if ( angle && ( v.x != 0 || v.y != 0 ) )
-    {
-      shift = ft_trig_prenorm( &v );
-      ft_trig_pseudo_rotate( &v, angle );
-      v.x = ft_trig_downscale( v.x );
-      v.y = ft_trig_downscale( v.y );
+    if ( v.x == 0 && v.y == 0 )
+      return;
 
-      if ( shift > 0 )
-      {
-        FT_Int32  half = (FT_Int32)1L << ( shift - 1 );
+    shift = ft_trig_prenorm( &v );
+    ft_trig_pseudo_rotate( &v, angle );
+    v.x = ft_trig_downscale( v.x );
+    v.y = ft_trig_downscale( v.y );
 
+    if ( shift > 0 )
+    {
+      FT_Int32  half = (FT_Int32)1L << ( shift - 1 );
 
-        vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;
-        vec->y = ( v.y + half + FT_SIGN_LONG( v.y ) ) >> shift;
-      }
-      else
-      {
-        shift  = -shift;
-        vec->x = (FT_Pos)( (FT_ULong)v.x << shift );
-        vec->y = (FT_Pos)( (FT_ULong)v.y << shift );
-      }
+
+      vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;
+      vec->y = ( v.y + half + FT_SIGN_LONG( v.y ) ) >> shift;
+    }
+    else
+    {
+      shift  = -shift;
+      vec->x = (FT_Pos)( (FT_ULong)v.x << shift );
+      vec->y = (FT_Pos)( (FT_ULong)v.y << shift );
     }
   }