[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
diff --git a/ChangeLog b/ChangeLog
index 7878fd5..01565a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-11 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [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 <wl@gnu.org>
[sfnt] Fix compiler warnings.
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 33c286e..eece0f8 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;