* src/smooth/ftgrays.c (gray_raster_render): Minor tweaks.

This commit is contained in:
Alexei Podtelezhnikov 2016-08-25 22:36:01 -04:00
parent a660e3de42
commit 9a444f0547
2 changed files with 27 additions and 21 deletions

View File

@ -1,3 +1,7 @@
2016-08-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_raster_render): Minor tweaks.
2016-08-26 Werner Lemberg <wl@gnu.org> 2016-08-26 Werner Lemberg <wl@gnu.org>
[type1] Fix heap buffer overflow. [type1] Fix heap buffer overflow.
@ -32,7 +36,7 @@
This removes unnecessary complexity of span merging and buffering. This removes unnecessary complexity of span merging and buffering.
Instead, the spans are rendered as they come, speeding up the Instead, the spans are rendered as they come, speeding up the
rendering by about 5% percents as a result. rendering by about 5% as a result.
* src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed. * src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed.
(gray_TWorker): Remove span buffer and related fields. (gray_TWorker): Remove span buffer and related fields.

View File

@ -1924,12 +1924,18 @@ typedef ptrdiff_t FT_PtrDist;
const FT_Bitmap* target_map = params->target; const FT_Bitmap* target_map = params->target;
FT_BBox cbox, clip; FT_BBox cbox, clip;
#ifndef FT_STATIC_RASTER
gray_TWorker worker[1]; gray_TWorker worker[1];
#endif
if ( !raster ) if ( !raster )
return FT_THROW( Invalid_Argument ); return FT_THROW( Invalid_Argument );
/* this version does not support monochrome rendering */
if ( !( params->flags & FT_RASTER_FLAG_AA ) )
return FT_THROW( Invalid_Mode );
if ( !outline ) if ( !outline )
return FT_THROW( Invalid_Outline ); return FT_THROW( Invalid_Outline );
@ -1944,9 +1950,19 @@ typedef ptrdiff_t FT_PtrDist;
outline->contours[outline->n_contours - 1] + 1 ) outline->contours[outline->n_contours - 1] + 1 )
return FT_THROW( Invalid_Outline ); return FT_THROW( Invalid_Outline );
/* if direct mode is not set, we must have a target bitmap */ ras.outline = *outline;
if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
if ( params->flags & FT_RASTER_FLAG_DIRECT )
{ {
if ( !params->gray_spans )
return 0;
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
ras.render_span_data = params->user;
}
else
{
/* if direct mode is not set, we must have a target bitmap */
if ( !target_map ) if ( !target_map )
return FT_THROW( Invalid_Argument ); return FT_THROW( Invalid_Argument );
@ -1956,11 +1972,11 @@ typedef ptrdiff_t FT_PtrDist;
if ( !target_map->buffer ) if ( !target_map->buffer )
return FT_THROW( Invalid_Argument ); return FT_THROW( Invalid_Argument );
}
/* this version does not support monochrome rendering */ ras.target = *target_map;
if ( !( params->flags & FT_RASTER_FLAG_AA ) ) ras.render_span = (FT_Raster_Span_Func)gray_render_span;
return FT_THROW( Invalid_Mode ); ras.render_span_data = &ras;
}
FT_Outline_Get_CBox( outline, &cbox ); FT_Outline_Get_CBox( outline, &cbox );
@ -2006,20 +2022,6 @@ typedef ptrdiff_t FT_PtrDist;
ras.count_ex = ras.max_ex - ras.min_ex; ras.count_ex = ras.max_ex - ras.min_ex;
ras.count_ey = ras.max_ey - ras.min_ey; ras.count_ey = ras.max_ey - ras.min_ey;
ras.outline = *outline;
if ( params->flags & FT_RASTER_FLAG_DIRECT )
{
ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
ras.render_span_data = params->user;
}
else
{
ras.target = *target_map;
ras.render_span = (FT_Raster_Span_Func)gray_render_span;
ras.render_span_data = &ras;
}
return gray_convert_glyph( RAS_VAR ); return gray_convert_glyph( RAS_VAR );
} }