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

This commit is contained in:
Alexei Podtelezhnikov 2015-03-20 21:34:19 -04:00
parent 772a5e5ddd
commit 2d7284e962
2 changed files with 24 additions and 21 deletions

View File

@ -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).

View File

@ -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 );
}
}