diff --git a/ChangeLog b/ChangeLog index b958c5820..8ed084ff8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-06-21 Werner Lemberg + + Code beautification. + + * src/type1/t1load.c (FT_INT_TO_FIXED): Removed. + Replace everywhere with INT_TO_FIXED. + (FT_FIXED_TO_INT): Move to ... + * include/freetype/internal/ftcalc.h (FIXED_TO_INT): Here. + Update all users. + 2009-06-20 Werner Lemberg Remove unused variables. diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index 58def34ca..f8b432477 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -165,6 +165,7 @@ FT_BEGIN_HEADER #define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) #define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 ) #define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) ) +#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 ) #define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ : ( -( ( 32 - (x) ) & -64 ) ) ) diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 06e72cca6..2e4700e54 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -213,10 +213,6 @@ } -#define FT_INT_TO_FIXED( a ) ( (a) << 16 ) -#define FT_FIXED_TO_INT( a ) ( FT_RoundFix( a ) >> 16 ) - - /*************************************************************************/ /* */ /* Given a normalized (blend) coordinate, figure out the design */ @@ -230,7 +226,7 @@ if ( ncv <= axismap->blend_points[0] ) - return FT_INT_TO_FIXED( axismap->design_points[0] ); + return INT_TO_FIXED( axismap->design_points[0] ); for ( j = 1; j < axismap->num_points; ++j ) { @@ -241,7 +237,7 @@ axismap->blend_points[j] - axismap->blend_points[j - 1] ); - return FT_INT_TO_FIXED( axismap->design_points[j - 1] ) + + return INT_TO_FIXED( axismap->design_points[j - 1] ) + FT_MulDiv( t, axismap->design_points[j] - axismap->design_points[j - 1], @@ -249,7 +245,7 @@ } } - return FT_INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] ); + return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] ); } @@ -331,8 +327,8 @@ for ( i = 0 ; i < mmaster.num_axis; ++i ) { mmvar->axis[i].name = mmaster.axis[i].name; - mmvar->axis[i].minimum = FT_INT_TO_FIXED( mmaster.axis[i].minimum); - mmvar->axis[i].maximum = FT_INT_TO_FIXED( mmaster.axis[i].maximum); + mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum); + mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum); mmvar->axis[i].def = ( mmvar->axis[i].minimum + mmvar->axis[i].maximum ) / 2; /* Does not apply. But this value is in range */ @@ -502,7 +498,7 @@ if ( num_coords <= 4 && num_coords > 0 ) { for ( i = 0; i < num_coords; ++i ) - lcoords[i] = FT_FIXED_TO_INT( coords[i] ); + lcoords[i] = FIXED_TO_INT( coords[i] ); error = T1_Set_MM_Design( face, num_coords, lcoords ); }