diff options
Diffstat (limited to 'include/freetype/internal/ftcalc.h')
-rw-r--r-- | include/freetype/internal/ftcalc.h | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index f8b4324..faac3a3 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, 2009 by */ +/* Copyright 1996-2006, 2008, 2009, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,7 +33,7 @@ FT_BEGIN_HEADER /* FT_FixedSqrt */ /* */ /* <Description> */ - /* Computes the square root of a 16.16 fixed point value. */ + /* Computes the square root of a 16.16 fixed-point value. */ /* */ /* <Input> */ /* x :: The value to compute the root for. */ @@ -48,29 +48,6 @@ FT_BEGIN_HEADER FT_SqrtFixed( FT_Int32 x ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Sqrt32 */ - /* */ - /* <Description> */ - /* Computes the square root of an Int32 integer (which will be */ - /* handled as an unsigned long value). */ - /* */ - /* <Input> */ - /* x :: The value to compute the root for. */ - /* */ - /* <Return> */ - /* The result of `sqrt(x)'. */ - /* */ - FT_EXPORT( FT_Int32 ) - FT_Sqrt32( FT_Int32 x ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */ @@ -78,8 +55,6 @@ FT_BEGIN_HEADER /*************************************************************************/ -#ifdef TT_USE_BYTECODE_INTERPRETER - /*************************************************************************/ /* */ /* <Function> */ @@ -87,7 +62,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* A very simple function used to perform the computation `(a*b)/c' */ - /* (without rounding) with maximal accuracy (it uses a 64-bit */ + /* (without rounding) with maximum accuracy (it uses a 64-bit */ /* intermediate integer whenever necessary). */ /* */ /* This function isn't necessarily as fast as some processor specific */ @@ -108,8 +83,6 @@ FT_BEGIN_HEADER FT_Long b, FT_Long c ); -#endif /* TT_USE_BYTECODE_INTERPRETER */ - /* * A variant of FT_Matrix_Multiply which scales its result afterwards. @@ -129,7 +102,6 @@ FT_BEGIN_HEADER * A variant of FT_Vector_Transform. See comments for * FT_Matrix_Multiply_Scaled. */ - FT_BASE( void ) FT_Vector_Transform_Scaled( FT_Vector* vector, const FT_Matrix* matrix, @@ -160,6 +132,22 @@ FT_BEGIN_HEADER FT_Pos out_y ); + /* + * Return the most significant bit index. + */ + FT_BASE( FT_Int ) + FT_MSB( FT_UInt32 z ); + + + /* + * Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses + * two fixed-point arguments instead. + */ + FT_BASE( FT_Fixed ) + FT_Hypot( FT_Fixed x, + FT_Fixed y ); + + #define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 ) #define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) #define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) |