* src/base/fttrigon.c (FT_Vector_Rotate): Avoid rounding errors

for small values.

* src/autohint/ahtypes.h (AH_PointRec): Remove unused `in_angle'
and `out_angle' fields.
This commit is contained in:
Werner Lemberg 2003-05-17 12:07:45 +00:00
parent de465e40c3
commit 6d2bb49e1e
3 changed files with 26 additions and 12 deletions

View File

@ -1,3 +1,13 @@
2003-05-15 David Turner <david@freetype.org>
* src/base/fttrigon.c (FT_Vector_Rotate): Avoid rounding errors
for small values.
2003-05-15 Werner Lemberg <wl@gnu.org>
* src/autohint/ahtypes.h (AH_PointRec): Remove unused `in_angle'
and `out_angle' fields.
2003-05-14 George Williams <gww@silcom.com>
* src/base/ftmac.c (FT_New_Face_From_SFNT): Handle CFF files also.

View File

@ -201,10 +201,6 @@ FT_BEGIN_HEADER
/* */
/* out_dir :: The direction of the outwards vector (point->next). */
/* */
/* in_angle :: The angle of the inwards vector. */
/* */
/* out_angle :: The angle of the outwards vector. */
/* */
/* next :: The next point in same contour. */
/* */
/* prev :: The previous point in same contour. */
@ -220,9 +216,6 @@ FT_BEGIN_HEADER
AH_Direction in_dir; /* direction of inwards vector */
AH_Direction out_dir; /* direction of outwards vector */
AH_Angle in_angle;
AH_Angle out_angle;
AH_Point next; /* next point in contour */
AH_Point prev; /* previous point in contour */

View File

@ -356,6 +356,14 @@
}
/* these macros return 0 for positive numbers,
and -1 for negative ones */
#define FT_SIGN_LONG( x ) ( (x) >> ( FT_SIZEOF_LONG * 8 - 1 ) )
#define FT_SIGN_INT( x ) ( (x) >> ( FT_SIZEOF_INT * 8 - 1 ) )
#define FT_SIGN_INT32( x ) ( (x) >> 31 )
#define FT_SIGN_INT16( x ) ( (x) >> 15 )
/* documentation is in fttrigon.h */
FT_EXPORT_DEF( void )
@ -366,8 +374,8 @@
FT_Vector v;
v.x = vec->x;
v.y = vec->y;
v.x = vec->x;
v.y = vec->y;
if ( angle && ( v.x != 0 || v.y != 0 ) )
{
@ -376,10 +384,13 @@
v.x = ft_trig_downscale( v.x );
v.y = ft_trig_downscale( v.y );
if ( shift >= 0 )
if ( shift > 0 )
{
vec->x = v.x >> shift;
vec->y = v.y >> shift;
FT_Int32 half = 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
{