... |
... |
@@ -1920,6 +1920,38 @@ typedef ptrdiff_t FT_PtrDist; |
1920
|
1920
|
)
|
1921
|
1921
|
|
1922
|
1922
|
|
|
1923
|
+ static long
|
|
1924
|
+ gray_taxi( RAS_ARG )
|
|
1925
|
+ {
|
|
1926
|
+ FT_Outline* outline = &ras.outline;
|
|
1927
|
+ short c, p, first, last;
|
|
1928
|
+ FT_Vector u, v;
|
|
1929
|
+ FT_Pos taxi;
|
|
1930
|
+
|
|
1931
|
+
|
|
1932
|
+ taxi = 0;
|
|
1933
|
+ last = -1;
|
|
1934
|
+ for ( c = 0; c < outline->n_contours; c++ )
|
|
1935
|
+ {
|
|
1936
|
+ first = last + 1;
|
|
1937
|
+ last = outline->contours[c];
|
|
1938
|
+
|
|
1939
|
+ u = outline->points[last];
|
|
1940
|
+ for ( p = first; p <= last; p++ )
|
|
1941
|
+ {
|
|
1942
|
+ v = outline->points[p];
|
|
1943
|
+
|
|
1944
|
+ taxi += v.x > u.x ? v.x - u.x : u.x - v.x;
|
|
1945
|
+ taxi += v.y > u.y ? v.y - u.y : u.y - v.y;
|
|
1946
|
+
|
|
1947
|
+ u = v;
|
|
1948
|
+ }
|
|
1949
|
+ }
|
|
1950
|
+
|
|
1951
|
+ return taxi >> 6;
|
|
1952
|
+ }
|
|
1953
|
+
|
|
1954
|
+
|
1923
|
1955
|
static int
|
1924
|
1956
|
gray_convert_glyph_inner( RAS_ARG_
|
1925
|
1957
|
int continued )
|
... |
... |
@@ -1964,7 +1996,8 @@ typedef ptrdiff_t FT_PtrDist; |
1964
|
1996
|
|
1965
|
1997
|
TCell* buffer;
|
1966
|
1998
|
size_t height = (size_t)( yMax - yMin );
|
1967
|
|
- size_t n = FT_MAX_GRAY_POOL / 8;
|
|
1999
|
+ size_t n;
|
|
2000
|
+ long size;
|
1968
|
2001
|
TCoord y;
|
1969
|
2002
|
TCoord bands[32]; /* enough to accommodate bisections */
|
1970
|
2003
|
TCoord* band;
|
... |
... |
@@ -1972,11 +2005,15 @@ typedef ptrdiff_t FT_PtrDist; |
1972
|
2005
|
int continued = 0;
|
1973
|
2006
|
|
1974
|
2007
|
|
1975
|
|
- if ( FT_QNEW_ARRAY ( buffer, FT_MAX_GRAY_POOL ) )
|
|
2008
|
+ size = gray_taxi( RAS_VAR ) +
|
|
2009
|
+ height * sizeof ( PCell ) / sizeof ( TCell ) +
|
|
2010
|
+ 4; /* somewhat naive */
|
|
2011
|
+
|
|
2012
|
+ if ( FT_QNEW_ARRAY ( buffer, size ) )
|
1976
|
2013
|
return error;
|
1977
|
2014
|
|
1978
|
2015
|
/* Initialize the null cell at the end of the poll. */
|
1979
|
|
- ras.cell_null = buffer + FT_MAX_GRAY_POOL - 1;
|
|
2016
|
+ ras.cell_null = buffer + size - 1;
|
1980
|
2017
|
ras.cell_null->x = CELL_MAX_X_VALUE;
|
1981
|
2018
|
ras.cell_null->area = 0;
|
1982
|
2019
|
ras.cell_null->cover = 0;
|
... |
... |
@@ -1985,13 +2022,6 @@ typedef ptrdiff_t FT_PtrDist; |
1985
|
2022
|
/* set up vertical bands */
|
1986
|
2023
|
ras.ycells = (PCell*)buffer;
|
1987
|
2024
|
|
1988
|
|
- if ( height > n )
|
1989
|
|
- {
|
1990
|
|
- /* two divisions rounded up */
|
1991
|
|
- n = ( height + n - 1 ) / n;
|
1992
|
|
- height = ( height + n - 1 ) / n;
|
1993
|
|
- }
|
1994
|
|
-
|
1995
|
2025
|
for ( y = yMin; y < yMax; )
|
1996
|
2026
|
{
|
1997
|
2027
|
ras.min_ey = y;
|