From 300458eb949f71a486710b69bb6b704139765b26 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 3 May 2019 23:16:42 -0400 Subject: [PATCH] Miscellaneous macro updates. * src/base/ftoutln.c (SCALED): Updated. * src/smooth/ftgrays.c (SCALED): Ditto. (FLOOR, ROUND, CEILING): Removed. * src/psaux/psfixed.h (cf2_fracToFixed): Updated. --- ChangeLog | 9 +++++++++ src/base/ftoutln.c | 3 +-- src/psaux/psfixed.h | 3 +-- src/smooth/ftgrays.c | 10 +--------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 172e16561..56db60a40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-05-03 Alexei Podtelezhnikov + + Miscellaneous macro updates. + + * src/base/ftoutln.c (SCALED): Updated. + * src/smooth/ftgrays.c (SCALED): Ditto. + (FLOOR, ROUND, CEILING): Removed. + * src/psaux/psfixed.h (cf2_fracToFixed): Updated. + 2019-05-02 Alexei Podtelezhnikov Tweak LCD filtering. diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 86fa1c22e..0e2ba3475 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -46,8 +46,7 @@ void* user ) { #undef SCALED -#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << shift ) \ - : ( (x) << shift ) ) - delta ) +#define SCALED( x ) ( (x) * ( 1L << shift ) - delta ) FT_Vector v_last; FT_Vector v_control; diff --git a/src/psaux/psfixed.h b/src/psaux/psfixed.h index fd3460f34..7dff9ef1b 100644 --- a/src/psaux/psfixed.h +++ b/src/psaux/psfixed.h @@ -72,8 +72,7 @@ FT_BEGIN_HEADER #define cf2_fixedFraction( x ) \ ( (x) - cf2_fixedFloor( x ) ) #define cf2_fracToFixed( x ) \ - ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \ - : ( ( (x) + 0x2000 ) >> 14 ) ) + ( ( (x) + 0x2000 - ( (x) < 0 ) ) >> 14 ) /* signed numeric types */ diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 72ab546a5..e39f00bd7 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -327,17 +327,9 @@ typedef ptrdiff_t FT_PtrDist; /* must be at least 6 bits! */ #define PIXEL_BITS 8 -#undef FLOOR -#undef CEILING -#undef TRUNC -#undef SCALED - #define ONE_PIXEL ( 1 << PIXEL_BITS ) #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) #define SUBPIXELS( x ) ( (TPos)(x) * ONE_PIXEL ) -#define FLOOR( x ) ( (x) & -ONE_PIXEL ) -#define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL ) -#define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL ) #if PIXEL_BITS >= 6 #define UPSCALE( x ) ( (x) * ( ONE_PIXEL >> 6 ) ) @@ -1337,7 +1329,7 @@ typedef ptrdiff_t FT_PtrDist; void* user ) { #undef SCALED -#define SCALED( x ) ( ( (x) << shift ) - delta ) +#define SCALED( x ) ( (x) * ( 1L << shift ) - delta ) FT_Vector v_last; FT_Vector v_control;