ref: 9a444f0547e661ad36a94869c86114502343e431
parent: a660e3de422731b94d4a134d27555430cbb6fb39
author: Alexei Podtelezhnikov <[email protected]>
date: Thu Aug 25 18:36:01 EDT 2016
* src/smooth/ftgrays.c (gray_raster_render): Minor tweaks.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-08-26 Alexei Podtelezhnikov <[email protected]>
+
+ * src/smooth/ftgrays.c (gray_raster_render): Minor tweaks.
+
2016-08-26 Werner Lemberg <[email protected]>
[type1] Fix heap buffer overflow.
@@ -32,7 +36,7 @@
This removes unnecessary complexity of span merging and buffering.
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.
(gray_TWorker): Remove span buffer and related fields.
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1924,12 +1924,18 @@
const FT_Bitmap* target_map = params->target;
FT_BBox cbox, clip;
+#ifndef FT_STATIC_RASTER
gray_TWorker worker[1];
+#endif
if ( !raster )
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 )
return FT_THROW( Invalid_Outline );
@@ -1944,9 +1950,19 @@
outline->contours[outline->n_contours - 1] + 1 )
return FT_THROW( Invalid_Outline );
- /* if direct mode is not set, we must have a target bitmap */
- if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
+ ras.outline = *outline;
+
+ 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 )
return FT_THROW( Invalid_Argument );
@@ -1956,12 +1972,12 @@
if ( !target_map->buffer )
return FT_THROW( Invalid_Argument );
+
+ ras.target = *target_map;
+ ras.render_span = (FT_Raster_Span_Func)gray_render_span;
+ ras.render_span_data = &ras;
}
- /* this version does not support monochrome rendering */
- if ( !( params->flags & FT_RASTER_FLAG_AA ) )
- return FT_THROW( Invalid_Mode );
-
FT_Outline_Get_CBox( outline, &cbox );
/* reject too large outline coordinates */
@@ -2005,20 +2021,6 @@
ras.count_ex = ras.max_ex - ras.min_ex;
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 );
}