* src/base/ftcalc.c (FT_SqrtFixed): corrected/optimised the 32-bit
fixed-point square root. it is now used even with 64-bits ints, as it's simply _much_ faster than calling FT_Sqrt64 :-) * src/base/ftbbox.c : removed invalid "#include FT_BEZIER_H" line
This commit is contained in:
parent
caf72cd6e5
commit
ec46b28df7
|
@ -1,3 +1,11 @@
|
||||||
|
2001-04-26 David Turner <david@freetype.org>
|
||||||
|
|
||||||
|
* src/base/ftcalc.c (FT_SqrtFixed): corrected/optimised the 32-bit
|
||||||
|
fixed-point square root. it is now used even with 64-bits
|
||||||
|
ints, as it's simply _much_ faster than calling FT_Sqrt64 :-)
|
||||||
|
|
||||||
|
* src/base/ftbbox.c : removed invalid "#include FT_BEZIER_H" line
|
||||||
|
|
||||||
2001-04-25 David Turner <david@freetype.org>
|
2001-04-25 David Turner <david@freetype.org>
|
||||||
|
|
||||||
* src/base/ftbbox.c (BBox_Cubic_Check): rewrote function to use
|
* src/base/ftbbox.c (BBox_Cubic_Check): rewrote function to use
|
||||||
|
|
|
@ -154,7 +154,7 @@ FT_BEGIN_HEADER
|
||||||
/* file "ftconfig.h" either statically, or through Autoconf */
|
/* file "ftconfig.h" either statically, or through Autoconf */
|
||||||
/* on platforms that support it. */
|
/* on platforms that support it. */
|
||||||
/* */
|
/* */
|
||||||
#define FT_CONFIG_OPTION_FORCE_INT64
|
#undef FT_CONFIG_OPTION_FORCE_INT64
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include FT_BBOX_H
|
#include FT_BBOX_H
|
||||||
#include FT_IMAGE_H
|
#include FT_IMAGE_H
|
||||||
#include FT_OUTLINE_H
|
#include FT_OUTLINE_H
|
||||||
#include FT_BEZIER_H
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct TBBox_Rec_
|
typedef struct TBBox_Rec_
|
||||||
|
@ -294,7 +293,7 @@
|
||||||
FT_Fixed uu;
|
FT_Fixed uu;
|
||||||
|
|
||||||
/* the polynom is "a*x^3 + 3b*x^2 + 3c*x + d", however, we also */
|
/* the polynom is "a*x^3 + 3b*x^2 + 3c*x + d", however, we also */
|
||||||
/* have dP/dx(u) = 0, which implies that P(t0) = b*t0^2 + 2c*t0 + d */
|
/* have dP/dx(u) = 0, which implies that P(u) = b*u^2 + 2c*u + d */
|
||||||
if ( u > 0 && u < 0x10000L )
|
if ( u > 0 && u < 0x10000L )
|
||||||
{
|
{
|
||||||
uu = FT_MulFix( u, u );
|
uu = FT_MulFix( u, u );
|
||||||
|
@ -369,7 +368,6 @@
|
||||||
|
|
||||||
if ( t1 > 0xFFFFFFL )
|
if ( t1 > 0xFFFFFFL )
|
||||||
{
|
{
|
||||||
/* on 64-bit machines .. */
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
shift--;
|
shift--;
|
||||||
|
|
|
@ -189,6 +189,7 @@
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* a helper function for FT_Sqrt64() */
|
/* a helper function for FT_Sqrt64() */
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -237,6 +238,7 @@
|
||||||
z = (FT_Int64)(x) << 16;
|
z = (FT_Int64)(x) << 16;
|
||||||
return FT_Sqrt64( z );
|
return FT_Sqrt64( z );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
||||||
|
|
||||||
|
@ -554,6 +556,10 @@
|
||||||
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FT_LONG64 */
|
||||||
|
|
||||||
|
|
||||||
/* a not-so-fast but working 16.16 fixed point square root function */
|
/* a not-so-fast but working 16.16 fixed point square root function */
|
||||||
FT_EXPORT_DEF( FT_Int32 ) FT_SqrtFixed( FT_Int32 x )
|
FT_EXPORT_DEF( FT_Int32 ) FT_SqrtFixed( FT_Int32 x )
|
||||||
{
|
{
|
||||||
|
@ -566,7 +572,7 @@
|
||||||
{
|
{
|
||||||
rem_hi = 0;
|
rem_hi = 0;
|
||||||
rem_lo = x;
|
rem_lo = x;
|
||||||
count = 32;
|
count = 24;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
rem_hi = (rem_hi << 2) | (rem_lo >> 30);
|
rem_hi = (rem_hi << 2) | (rem_lo >> 30);
|
||||||
|
@ -578,14 +584,12 @@
|
||||||
rem_hi -= test_div;
|
rem_hi -= test_div;
|
||||||
root += 1;
|
root += 1;
|
||||||
}
|
}
|
||||||
count--;
|
|
||||||
}
|
}
|
||||||
|
while (--count);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FT_Int32)root;
|
return (FT_Int32)root;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FT_LONG64 */
|
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
|
|
Loading…
Reference in New Issue