Added implementation of three new functions: FT_RoundFix, FT_CeilFix, and FT_FloorFix.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index c1a3ffd..d67a96a 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -26,7 +26,8 @@
/* */
/* Implementing basic computation routines. */
/* */
- /* FT_MulDiv(), FT_MulFix(), and FT_DivFix() are declared in freetype.h. */
+ /* FT_MulDiv(), FT_MulFix(), FT_DivFix(), FT_RoundFix(), FT_CeilFix(), */
+ /* and FT_FloorFix() are declared in freetype.h. */
/* */
/*************************************************************************/
@@ -46,6 +47,32 @@
#undef FT_COMPONENT
#define FT_COMPONENT trace_calc
+ /* The following three functions are available regardless of whether */
+ /* FT_LONG64 or FT_CONFIG_OPTION_OLD_CALCS is defined. */
+
+ /* documentation is in freetype.h */
+
+ FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a )
+ {
+ return( ( a + 0x8000L ) & -0x10000L );
+ }
+
+
+ /* documentation is in freetype.h */
+
+ FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a )
+ {
+ return( ( a + 0x10000L - 1 ) & -0x10000L );
+ }
+
+
+ /* documentation is in freetype.h */
+
+ FT_EXPORT_DEF( FT_Fixed ) FT_FloorFix( FT_Fixed a )
+ {
+ return( a & -0x10000L );
+ }
+
#ifdef FT_CONFIG_OPTION_OLD_CALCS