ref: 4d3f7ca8cedbddad40b9e93a82926618e3fb4265
parent: 57aa83911a080b4af23fbc750cd7fb08e084c59a
author: Alexei Podtelezhnikov <[email protected]>
date: Sat Aug 27 19:25:54 EDT 2016
[smooth] Reduce stack of band boundaries. * src/smooth/ftgrays.c (gray_TBand): Removed. (gray_convert_glyph): Updated to stack band boundaries concisely.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-08-27 Alexei Podtelezhnikov <[email protected]>
+
+ [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 <[email protected]>
* src/cid/cidload.c (cid_face_open): Improve handling of `SDBytes'.
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1765,13 +1765,6 @@
#endif /* STANDALONE_ */
- typedef struct gray_TBand_
- {
- TCoord min, max;
-
- } gray_TBand;
-
-
FT_DEFINE_OUTLINE_FUNCS(
func_interface,
@@ -1818,12 +1811,12 @@
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 @@
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 @@
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 @@
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 );
}