[smooth] Reduce stack of band boundaries. * src/smooth/ftgrays.c (gray_TBand): Removed. (gray_convert_glyph): Updated to stack band boundaries concisely.
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
diff --git a/ChangeLog b/ChangeLog
index 5a07f8f..38eb21b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-08-27 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [smooth] Reduce stack of band boundaries.
+
+ * src/smooth/ftgrays.c (gray_TBand): Removed.
+ (gray_convert_glyph): Updated to stack band boundaries concisely.
+
2016-08-26 Werner Lemberg <wl@gnu.org>
* src/cid/cidload.c (cid_face_open): Improve handling of `SDBytes'.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 8e1dcbe..296daa4 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1765,13 +1765,6 @@ typedef ptrdiff_t FT_PtrDist;
#endif /* STANDALONE_ */
- typedef struct gray_TBand_
- {
- TCoord min, max;
-
- } gray_TBand;
-
-
FT_DEFINE_OUTLINE_FUNCS(
func_interface,
@@ -1818,12 +1811,12 @@ typedef ptrdiff_t FT_PtrDist;
static int
gray_convert_glyph( RAS_ARG )
{
- TCell buffer[FT_MAX_GRAY_POOL];
- TCoord band_size = FT_MAX_GRAY_POOL / 8;
- int num_bands;
- TCoord min, max, max_y;
- gray_TBand bands[32]; /* enough to accommodate bisections */
- gray_TBand* band;
+ TCell buffer[FT_MAX_GRAY_POOL];
+ TCoord band_size = FT_MAX_GRAY_POOL / 8;
+ int num_bands;
+ TCoord min, max, max_y;
+ TCoord bands[32]; /* enough to accommodate bisections */
+ TCoord* band;
/* set up vertical bands */
@@ -1843,19 +1836,19 @@ typedef ptrdiff_t FT_PtrDist;
if ( max > max_y )
max = max_y;
- bands[0].min = min;
- bands[0].max = max;
- band = bands;
+ band = bands;
+ band[1] = min;
+ band[0] = max;
do
{
- TCoord bottom, top, middle;
+ TCoord width = band[0] - band[1];
int error;
/* memory management */
{
- size_t ycount = (size_t)( band->max - band->min );
+ size_t ycount = (size_t)width;
size_t cell_start;
@@ -1875,9 +1868,9 @@ typedef ptrdiff_t FT_PtrDist;
ras.num_cells = 0;
ras.invalid = 1;
- ras.min_ey = band->min;
- ras.max_ey = band->max;
- ras.count_ey = band->max - band->min;
+ ras.min_ey = band[1];
+ ras.max_ey = band[0];
+ ras.count_ey = width;
error = gray_convert_glyph_inner( RAS_VAR );
@@ -1892,23 +1885,19 @@ typedef ptrdiff_t FT_PtrDist;
ReduceBands:
/* render pool overflow; we will reduce the render band by half */
- bottom = band->min;
- top = band->max;
- middle = bottom + ( ( top - bottom ) >> 1 );
+ width >>= 1;
/* This is too complex for a single scanline; there must */
/* be some problems. */
- if ( middle == bottom )
+ if ( width == 0 )
{
FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
return 1;
}
- band[1].min = bottom;
- band[1].max = middle;
- band[0].min = middle;
- band[0].max = top;
band++;
+ band[1] = band[0];
+ band[0] += width;
} while ( band >= bands );
}