diff --git a/src/sdf/ftsdfcommon.c b/src/sdf/ftsdfcommon.c index 5841ded21..6b2cf7dfe 100644 --- a/src/sdf/ftsdfcommon.c +++ b/src/sdf/ftsdfcommon.c @@ -22,49 +22,6 @@ #include "ftsdfcommon.h" - /************************************************************************** - * - * common functions - * - */ - - /* - * Original algorithm: - * - * https://github.com/chmike/fpsqrt - * - * Use this to compute the square root of a 16.16 fixed-point number. - */ - FT_LOCAL_DEF( FT_16D16 ) - square_root( FT_16D16 val ) - { - FT_ULong t, q, b, r; - - - r = (FT_ULong)val; - b = 0x40000000L; - q = 0; - - while ( b > 0x40L ) - { - t = q + b; - - if ( r >= t ) - { - r -= t; - q = t + b; - } - - r <<= 1; - b >>= 1; - } - - q >>= 8; - - return (FT_16D16)q; - } - - /************************************************************************** * * format and sign manipulating functions diff --git a/src/sdf/ftsdfcommon.h b/src/sdf/ftsdfcommon.h index 44274e349..d0f623f9f 100644 --- a/src/sdf/ftsdfcommon.h +++ b/src/sdf/ftsdfcommon.h @@ -122,8 +122,7 @@ FT_BEGIN_HEADER typedef FT_BBox FT_CBox; /* control box of a curve */ - FT_LOCAL( FT_16D16 ) - square_root( FT_16D16 val ); +#define square_root( x ) (FT_16D16)FT_SqrtFixed( (FT_UInt32)( x ) ) FT_LOCAL( FT_SDFFormat ) map_fixed_to_sdf( FT_16D16 dist,