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


			
			
				BRANCH-2-1-5
			
			
		
Werner Lemberg 22 years ago
parent de465e40c3
commit 6d2bb49e1e
  1. 10
      ChangeLog
  2. 7
      src/autohint/ahtypes.h
  3. 21
      src/base/fttrigon.c

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

@ -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 */

@ -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
{

Loading…
Cancel
Save