ref: 2d7284e962b5fe93c8f5c95768239d7480e50d28
parent: 772a5e5ddd2861e9b27de745699670e746442e0e
author: Alexei Podtelezhnikov <[email protected]>
date: Fri Mar 20 17:34:19 EDT 2015
* src/base/fttrigon.c (FT_Vector_Rotate): Minor refactoring.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-20 Alexei Podtelezhnikov <[email protected]>
+
+ * src/base/fttrigon.c (FT_Vector_Rotate): Minor refactoring.
+
2015-03-17 Alexei Podtelezhnikov <[email protected]>
Fix Savannah bug #44412 (part 2).
--- 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 );
}
}