diff --git a/ChangeLog b/ChangeLog index 3b21ff62e..2185d925f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-03-20 Alexei Podtelezhnikov + + * src/base/fttrigon.c (FT_Vector_Rotate): Minor refactoring. + 2015-03-17 Alexei Podtelezhnikov Fix Savannah bug #44412 (part 2). diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c index 8972ba86d..42552459c 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 ) ) + if ( v.x == 0 && v.y == 0 ) + return; + + 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 ) { - 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 ); + 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 ); } }