From eaa5a42a12ce1f1fe005109da6841e411babe826 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 11 Jun 2018 21:56:23 -0400 Subject: [PATCH] [raster] Clean up. * src/raster/ftraster.c (black_TWorker, SCALED, Set_High_Precision): Clean up after 5-level gray removal (8dc8635874). (Vertical_Sweep_Span): Be brief. --- ChangeLog | 8 ++++++++ src/raster/ftraster.c | 23 ++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7878fd5d7..01565a7eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-06-11 Alexei Podtelezhnikov + + [raster] Clean up. + + * src/raster/ftraster.c (black_TWorker, SCALED, Set_High_Precision): + Clean up after 5-level gray removal (8dc8635874). + (Vertical_Sweep_Span): Be brief. + 2018-06-10 Werner Lemberg [sfnt] Fix compiler warnings. diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 33c286eb3..eece0f848 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -451,9 +451,9 @@ #define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision ) #define TRUNC( x ) ( (Long)(x) >> ras.precision_bits ) #define FRAC( x ) ( (x) & ( ras.precision - 1 ) ) -#define SCALED( x ) ( ( (x) < 0 ? -( -(x) << ras.scale_shift ) \ - : ( (x) << ras.scale_shift ) ) \ - - ras.precision_half ) + + /* scale and shift grid to pixel centers */ +#define SCALED( x ) ( (x) * ras.precision_scale - ras.precision_half ) #define IS_BOTTOM_OVERSHOOT( x ) \ (Bool)( CEILING( x ) - x >= ras.precision_half ) @@ -475,13 +475,10 @@ Int precision_bits; /* precision related variables */ Int precision; Int precision_half; - Int precision_shift; + Int precision_scale; Int precision_step; Int precision_jitter; - Int scale_shift; /* == precision_shift for bitmaps */ - /* == precision_shift+1 for pixmaps */ - PLong buff; /* The profiles buffer */ PLong sizeBuff; /* Render pool size */ PLong maxBuff; /* Profiles buffer size */ @@ -622,8 +619,8 @@ FT_TRACE6(( "Set_High_Precision(%s)\n", High ? "true" : "false" )); ras.precision = 1 << ras.precision_bits; - ras.precision_half = ras.precision / 2; - ras.precision_shift = ras.precision_bits - Pixel_Bits; + ras.precision_half = ras.precision >> 1; + ras.precision_scale = ras.precision >> Pixel_Bits; } @@ -2286,12 +2283,9 @@ /* memset() is slower than the following code on many platforms. */ /* This is due to the fact that, in the vast majority of cases, */ /* the span length in bytes is relatively small. */ - c2--; - while ( c2 > 0 ) - { + while ( --c2 > 0 ) *(++target) = 0xFF; - c2--; - } + target[1] |= f2; } else @@ -3092,7 +3086,6 @@ Set_High_Precision( RAS_VARS ras.outline.flags & FT_OUTLINE_HIGH_PRECISION ); - ras.scale_shift = ras.precision_shift; if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS ) ras.dropOutControl = 2;