[smooth] Store persistent clipping box.
* src/smooth/ftgrays.c (gray_TWorker, gray_raster_render): Add and set the new structure field. (gray_convert_glyph): Use it.
This commit is contained in:
parent
f42ce25563
commit
674d629b5e
|
@ -489,7 +489,7 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
|
|
||||||
typedef struct gray_TWorker_
|
typedef struct gray_TWorker_
|
||||||
{
|
{
|
||||||
ft_jmp_buf jump_buffer;
|
FT_BBox cbox;
|
||||||
|
|
||||||
TCoord min_ex, max_ex; /* min and max integer pixel coordinates */
|
TCoord min_ex, max_ex; /* min and max integer pixel coordinates */
|
||||||
TCoord min_ey, max_ey;
|
TCoord min_ey, max_ey;
|
||||||
|
@ -510,6 +510,8 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
FT_Raster_Span_Func render_span;
|
FT_Raster_Span_Func render_span;
|
||||||
void* render_span_data;
|
void* render_span_data;
|
||||||
|
|
||||||
|
ft_jmp_buf jump_buffer;
|
||||||
|
|
||||||
} gray_TWorker, *gray_PWorker;
|
} gray_TWorker, *gray_PWorker;
|
||||||
|
|
||||||
#if defined( _MSC_VER )
|
#if defined( _MSC_VER )
|
||||||
|
@ -1863,11 +1865,8 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
static int
|
static int
|
||||||
gray_convert_glyph( RAS_ARG )
|
gray_convert_glyph( RAS_ARG )
|
||||||
{
|
{
|
||||||
const TCoord yMin = ras.min_ey;
|
|
||||||
const TCoord yMax = ras.max_ey;
|
|
||||||
|
|
||||||
TCell buffer[FT_MAX_GRAY_POOL];
|
TCell buffer[FT_MAX_GRAY_POOL];
|
||||||
size_t height = (size_t)( yMax - yMin );
|
size_t height = (size_t)( ras.cbox.yMax - ras.cbox.yMin );
|
||||||
size_t n = FT_MAX_GRAY_POOL / 8;
|
size_t n = FT_MAX_GRAY_POOL / 8;
|
||||||
TCoord y;
|
TCoord y;
|
||||||
TCoord bands[32]; /* enough to accommodate bisections */
|
TCoord bands[32]; /* enough to accommodate bisections */
|
||||||
|
@ -1893,11 +1892,14 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
height = ( height + n - 1 ) / n;
|
height = ( height + n - 1 ) / n;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( y = yMin; y < yMax; )
|
ras.min_ex = ras.cbox.xMin;
|
||||||
|
ras.max_ex = ras.cbox.xMax;
|
||||||
|
|
||||||
|
for ( y = ras.cbox.yMin; y < ras.cbox.yMax; )
|
||||||
{
|
{
|
||||||
ras.min_ey = y;
|
ras.min_ey = y;
|
||||||
y += height;
|
y += height;
|
||||||
ras.max_ey = FT_MIN( y, yMax );
|
ras.max_ey = FT_MIN( y, ras.cbox.yMax );
|
||||||
|
|
||||||
band = bands;
|
band = bands;
|
||||||
band[1] = ras.min_ey;
|
band[1] = ras.min_ey;
|
||||||
|
@ -2001,10 +2003,7 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
|
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
|
||||||
ras.render_span_data = params->user;
|
ras.render_span_data = params->user;
|
||||||
|
|
||||||
ras.min_ex = params->clip_box.xMin;
|
ras.cbox = params->clip_box;
|
||||||
ras.min_ey = params->clip_box.yMin;
|
|
||||||
ras.max_ex = params->clip_box.xMax;
|
|
||||||
ras.max_ey = params->clip_box.yMax;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2030,14 +2029,14 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
ras.render_span = (FT_Raster_Span_Func)NULL;
|
ras.render_span = (FT_Raster_Span_Func)NULL;
|
||||||
ras.render_span_data = NULL;
|
ras.render_span_data = NULL;
|
||||||
|
|
||||||
ras.min_ex = 0;
|
ras.cbox.xMin = 0;
|
||||||
ras.min_ey = 0;
|
ras.cbox.yMin = 0;
|
||||||
ras.max_ex = (FT_Pos)target_map->width;
|
ras.cbox.xMax = (FT_Pos)target_map->width;
|
||||||
ras.max_ey = (FT_Pos)target_map->rows;
|
ras.cbox.yMax = (FT_Pos)target_map->rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exit if nothing to do */
|
/* exit if nothing to do */
|
||||||
if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey )
|
if ( ras.cbox.xMin >= ras.cbox.xMax || ras.cbox.yMin >= ras.cbox.yMax )
|
||||||
return Smooth_Err_Ok;
|
return Smooth_Err_Ok;
|
||||||
|
|
||||||
return gray_convert_glyph( RAS_VAR );
|
return gray_convert_glyph( RAS_VAR );
|
||||||
|
|
Loading…
Reference in New Issue