... |
... |
@@ -489,7 +489,7 @@ typedef ptrdiff_t FT_PtrDist; |
489
|
489
|
|
490
|
490
|
typedef struct gray_TWorker_
|
491
|
491
|
{
|
492
|
|
- ft_jmp_buf jump_buffer;
|
|
492
|
+ FT_BBox cbox;
|
493
|
493
|
|
494
|
494
|
TCoord min_ex, max_ex; /* min and max integer pixel coordinates */
|
495
|
495
|
TCoord min_ey, max_ey;
|
... |
... |
@@ -510,6 +510,8 @@ typedef ptrdiff_t FT_PtrDist; |
510
|
510
|
FT_Raster_Span_Func render_span;
|
511
|
511
|
void* render_span_data;
|
512
|
512
|
|
|
513
|
+ ft_jmp_buf jump_buffer;
|
|
514
|
+
|
513
|
515
|
} gray_TWorker, *gray_PWorker;
|
514
|
516
|
|
515
|
517
|
#if defined( _MSC_VER )
|
... |
... |
@@ -1863,11 +1865,8 @@ typedef ptrdiff_t FT_PtrDist; |
1863
|
1865
|
static int
|
1864
|
1866
|
gray_convert_glyph( RAS_ARG )
|
1865
|
1867
|
{
|
1866
|
|
- const TCoord yMin = ras.min_ey;
|
1867
|
|
- const TCoord yMax = ras.max_ey;
|
1868
|
|
-
|
1869
|
1868
|
TCell buffer[FT_MAX_GRAY_POOL];
|
1870
|
|
- size_t height = (size_t)( yMax - yMin );
|
|
1869
|
+ size_t height = (size_t)( ras.cbox.yMax - ras.cbox.yMin );
|
1871
|
1870
|
size_t n = FT_MAX_GRAY_POOL / 8;
|
1872
|
1871
|
TCoord y;
|
1873
|
1872
|
TCoord bands[32]; /* enough to accommodate bisections */
|
... |
... |
@@ -1893,35 +1892,36 @@ typedef ptrdiff_t FT_PtrDist; |
1893
|
1892
|
height = ( height + n - 1 ) / n;
|
1894
|
1893
|
}
|
1895
|
1894
|
|
1896
|
|
- for ( y = yMin; y < yMax; )
|
|
1895
|
+ for ( y = ras.cbox.yMin; y < ras.cbox.yMax; )
|
1897
|
1896
|
{
|
1898
|
1897
|
ras.min_ey = y;
|
1899
|
1898
|
y += height;
|
1900
|
|
- ras.max_ey = FT_MIN( y, yMax );
|
|
1899
|
+ ras.max_ey = FT_MIN( y, ras.cbox.yMax );
|
|
1900
|
+
|
|
1901
|
+ ras.count_ey = ras.max_ey - ras.min_ey;
|
1901
|
1902
|
|
1902
|
1903
|
band = bands;
|
1903
|
|
- band[1] = ras.min_ey;
|
1904
|
|
- band[0] = ras.max_ey;
|
|
1904
|
+ band[1] = ras.cbox.xMin;
|
|
1905
|
+ band[0] = ras.cbox.xMax;
|
1905
|
1906
|
|
1906
|
1907
|
do
|
1907
|
1908
|
{
|
1908
|
|
- TCoord width = band[0] - band[1];
|
1909
|
|
- TCoord w;
|
|
1909
|
+ TCoord i;
|
1910
|
1910
|
int error;
|
1911
|
1911
|
|
1912
|
1912
|
|
1913
|
|
- for ( w = 0; w < width; ++w )
|
1914
|
|
- ras.ycells[w] = ras.cell_null;
|
|
1913
|
+ ras.min_ex = band[1];
|
|
1914
|
+ ras.max_ex = band[0];
|
|
1915
|
+
|
|
1916
|
+ /* memory management: zero out and skip ycells */
|
|
1917
|
+ for ( i = 0; i < ras.count_ey; ++i )
|
|
1918
|
+ ras.ycells[i] = ras.cell_null;
|
1915
|
1919
|
|
1916
|
|
- /* memory management: skip ycells */
|
1917
|
|
- n = ( (size_t)width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
|
1918
|
|
- sizeof ( TCell );
|
|
1920
|
+ n = ( (size_t)ras.count_ey * sizeof ( PCell ) + sizeof ( TCell ) - 1 )
|
|
1921
|
+ / sizeof ( TCell );
|
1919
|
1922
|
|
1920
|
1923
|
ras.cell_free = buffer + n;
|
1921
|
1924
|
ras.cell = ras.cell_null;
|
1922
|
|
- ras.min_ey = band[1];
|
1923
|
|
- ras.max_ey = band[0];
|
1924
|
|
- ras.count_ey = width;
|
1925
|
1925
|
|
1926
|
1926
|
error = gray_convert_glyph_inner( RAS_VAR_ continued );
|
1927
|
1927
|
continued = 1;
|
... |
... |
@@ -1939,10 +1939,10 @@ typedef ptrdiff_t FT_PtrDist; |
1939
|
1939
|
return error;
|
1940
|
1940
|
|
1941
|
1941
|
/* render pool overflow; we will reduce the render band by half */
|
1942
|
|
- width >>= 1;
|
|
1942
|
+ i = ( band[0] - band[1] ) >> 1;
|
1943
|
1943
|
|
1944
|
1944
|
/* this should never happen even with tiny rendering pool */
|
1945
|
|
- if ( width == 0 )
|
|
1945
|
+ if ( i == 0 )
|
1946
|
1946
|
{
|
1947
|
1947
|
FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
|
1948
|
1948
|
return FT_THROW( Raster_Overflow );
|
... |
... |
@@ -1950,7 +1950,7 @@ typedef ptrdiff_t FT_PtrDist; |
1950
|
1950
|
|
1951
|
1951
|
band++;
|
1952
|
1952
|
band[1] = band[0];
|
1953
|
|
- band[0] += width;
|
|
1953
|
+ band[0] += i;
|
1954
|
1954
|
} while ( band >= bands );
|
1955
|
1955
|
}
|
1956
|
1956
|
|
... |
... |
@@ -2001,10 +2001,7 @@ typedef ptrdiff_t FT_PtrDist; |
2001
|
2001
|
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
|
2002
|
2002
|
ras.render_span_data = params->user;
|
2003
|
2003
|
|
2004
|
|
- ras.min_ex = params->clip_box.xMin;
|
2005
|
|
- ras.min_ey = params->clip_box.yMin;
|
2006
|
|
- ras.max_ex = params->clip_box.xMax;
|
2007
|
|
- ras.max_ey = params->clip_box.yMax;
|
|
2004
|
+ ras.cbox = params->clip_box;
|
2008
|
2005
|
}
|
2009
|
2006
|
else
|
2010
|
2007
|
{
|
... |
... |
@@ -2030,14 +2027,14 @@ typedef ptrdiff_t FT_PtrDist; |
2030
|
2027
|
ras.render_span = (FT_Raster_Span_Func)NULL;
|
2031
|
2028
|
ras.render_span_data = NULL;
|
2032
|
2029
|
|
2033
|
|
- ras.min_ex = 0;
|
2034
|
|
- ras.min_ey = 0;
|
2035
|
|
- ras.max_ex = (FT_Pos)target_map->width;
|
2036
|
|
- ras.max_ey = (FT_Pos)target_map->rows;
|
|
2030
|
+ ras.cbox.xMin = 0;
|
|
2031
|
+ ras.cbox.yMin = 0;
|
|
2032
|
+ ras.cbox.xMax = (FT_Pos)target_map->width;
|
|
2033
|
+ ras.cbox.yMax = (FT_Pos)target_map->rows;
|
2037
|
2034
|
}
|
2038
|
2035
|
|
2039
|
2036
|
/* exit if nothing to do */
|
2040
|
|
- if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey )
|
|
2037
|
+ if ( ras.cbox.xMin >= ras.cbox.xMax || ras.cbox.yMin >= ras.cbox.yMax )
|
2041
|
2038
|
return Smooth_Err_Ok;
|
2042
|
2039
|
|
2043
|
2040
|
return gray_convert_glyph( RAS_VAR );
|