Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType
Commits:
-
d0e3239f
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-06T13:39:06+00:00
2 changed files:
Changes:
... | ... | @@ -22,49 +22,6 @@ |
22 | 22 | #include "ftsdfcommon.h"
|
23 | 23 | |
24 | 24 | |
25 | - /**************************************************************************
|
|
26 | - *
|
|
27 | - * common functions
|
|
28 | - *
|
|
29 | - */
|
|
30 | - |
|
31 | - /*
|
|
32 | - * Original algorithm:
|
|
33 | - *
|
|
34 | - * https://github.com/chmike/fpsqrt
|
|
35 | - *
|
|
36 | - * Use this to compute the square root of a 16.16 fixed-point number.
|
|
37 | - */
|
|
38 | - FT_LOCAL_DEF( FT_16D16 )
|
|
39 | - square_root( FT_16D16 val )
|
|
40 | - {
|
|
41 | - FT_ULong t, q, b, r;
|
|
42 | - |
|
43 | - |
|
44 | - r = (FT_ULong)val;
|
|
45 | - b = 0x40000000L;
|
|
46 | - q = 0;
|
|
47 | - |
|
48 | - while ( b > 0x40L )
|
|
49 | - {
|
|
50 | - t = q + b;
|
|
51 | - |
|
52 | - if ( r >= t )
|
|
53 | - {
|
|
54 | - r -= t;
|
|
55 | - q = t + b;
|
|
56 | - }
|
|
57 | - |
|
58 | - r <<= 1;
|
|
59 | - b >>= 1;
|
|
60 | - }
|
|
61 | - |
|
62 | - q >>= 8;
|
|
63 | - |
|
64 | - return (FT_16D16)q;
|
|
65 | - }
|
|
66 | - |
|
67 | - |
|
68 | 25 | /**************************************************************************
|
69 | 26 | *
|
70 | 27 | * format and sign manipulating functions
|
... | ... | @@ -122,8 +122,7 @@ FT_BEGIN_HEADER |
122 | 122 | typedef FT_BBox FT_CBox; /* control box of a curve */
|
123 | 123 | |
124 | 124 | |
125 | - FT_LOCAL( FT_16D16 )
|
|
126 | - square_root( FT_16D16 val );
|
|
125 | +#define square_root( x ) (FT_16D16)FT_SqrtFixed( (FT_UInt32)( x ) )
|
|
127 | 126 | |
128 | 127 | FT_LOCAL( FT_SDFFormat )
|
129 | 128 | map_fixed_to_sdf( FT_16D16 dist,
|