* src/smooth/ftgrays.c (gray_raster_render): Minor tweaks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
diff --git a/ChangeLog b/ChangeLog
index bbb3d32..8b1e97a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
[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.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 6f438ab..8e1dcbe 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1924,12 +1924,18 @@ typedef ptrdiff_t FT_PtrDist;
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 @@ typedef ptrdiff_t FT_PtrDist;
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,11 +1972,11 @@ typedef ptrdiff_t FT_PtrDist;
if ( !target_map->buffer )
return FT_THROW( Invalid_Argument );
- }
- /* this version does not support monochrome rendering */
- if ( !( params->flags & FT_RASTER_FLAG_AA ) )
- return FT_THROW( Invalid_Mode );
+ ras.target = *target_map;
+ ras.render_span = (FT_Raster_Span_Func)gray_render_span;
+ ras.render_span_data = &ras;
+ }
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_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 );
}