fix for the latest rasterizer optimization
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
diff --git a/ChangeLog b/ChangeLog
index b299b53..a375123 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-09-04 David Turner <david@freetype.org>
+
+ * src/smooth/ftgrays.c: fix for the latest rasterizer optimization
+
2006-09-03 Werner Lemberg <wl@gnu.org>
* devel/ftoption.h: Synchronize with
@@ -1293,7 +1297,7 @@
compatibility code.
* src/cache/ftcbasic.c: Fix a silly bug that prevented our `hack' to
- support rogue clients compiled against 2.1.7 to work correctly.
+ support rogue clients compiled against 2.1.7 to work correctly.
This probably explains the GNUstep crashes with the second release
candidate.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 0410d5f..08b797e 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1651,21 +1651,21 @@ typedef struct TCell_
{
PCell cells_max;
int yindex;
- long cell_start, cell_mod;
+ long cell_start, cell_end, cell_mod;
ras.ycells = (PCell*)ras.buffer;
ras.ycount = band->max - band->min;
- for ( yindex = 0; yindex < ras.ycount; yindex++ )
- ras.ycells[yindex] = NULL;
-
cell_start = sizeof ( PCell ) * ras.ycount;
cell_mod = cell_start % sizeof ( TCell );
if ( cell_mod > 0 )
cell_start += sizeof ( TCell ) - cell_mod;
- cells_max = (PCell)( (char*)ras.buffer + ras.buffer_size );
+ cell_end = ras.buffer_size;
+ cell_end -= cell_end % sizeof( TCell );
+
+ cells_max = (PCell)( (char*)ras.buffer + cell_end );
ras.cells = (PCell)( (char*)ras.buffer + cell_start );
if ( ras.cells >= cells_max )
goto ReduceBands;
@@ -1673,6 +1673,9 @@ typedef struct TCell_
ras.max_cells = cells_max - ras.cells;
if ( ras.max_cells < 2 )
goto ReduceBands;
+
+ for ( yindex = 0; yindex < ras.ycount; yindex++ )
+ ras.ycells[yindex] = NULL;
}
ras.num_cells = 0;