summaryrefslogtreecommitdiff
path: root/third_party/freetype/src/base/ftoutln.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/freetype/src/base/ftoutln.c')
-rw-r--r--third_party/freetype/src/base/ftoutln.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/third_party/freetype/src/base/ftoutln.c b/third_party/freetype/src/base/ftoutln.c
index 35cc9f5569..464a066dcc 100644
--- a/third_party/freetype/src/base/ftoutln.c
+++ b/third_party/freetype/src/base/ftoutln.c
@@ -4,7 +4,7 @@
/* */
/* FreeType outline management (body). */
/* */
-/* Copyright 1996-2015 by */
+/* Copyright 1996-2017 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -42,7 +42,7 @@
static
- const FT_Outline null_outline = { 0, 0, 0, 0, 0, 0 };
+ const FT_Outline null_outline = { 0, 0, NULL, NULL, NULL, 0 };
/* documentation is in ftoutln.h */
@@ -287,7 +287,7 @@
return FT_Err_Ok;
Exit:
- FT_TRACE5(( "FT_Outline_Decompose: Error %d\n", error ));
+ FT_TRACE5(( "FT_Outline_Decompose: Error 0x%x\n", error ));
return error;
Invalid_Outline:
@@ -415,11 +415,14 @@
if ( source == target )
return FT_Err_Ok;
- FT_ARRAY_COPY( target->points, source->points, source->n_points );
-
- FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
+ if ( source->n_points )
+ {
+ FT_ARRAY_COPY( target->points, source->points, source->n_points );
+ FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
+ }
- FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
+ if ( source->n_contours )
+ FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
/* copy all flags, except the `FT_OUTLINE_OWNER' one */
is_owner = target->flags & FT_OUTLINE_OWNER;
@@ -942,6 +945,9 @@
l_in = 0;
last = outline->contours[c];
+ /* pacify compiler */
+ in.x = in.y = anchor.x = anchor.y = 0;
+
/* Counter j cycles though the points; counter i advances only */
/* when points are moved; anchor k marks the first moved point. */
for ( i = last, j = first, k = -1;
@@ -1074,13 +1080,16 @@
FT_Int last = outline->contours[c];
- v_prev = points[last];
+ v_prev.x = points[last].x >> xshift;
+ v_prev.y = points[last].y >> yshift;
for ( n = first; n <= last; n++ )
{
- v_cur = points[n];
- area += ( ( v_cur.y - v_prev.y ) >> yshift ) *
- ( ( v_cur.x + v_prev.x ) >> xshift );
+ v_cur.x = points[n].x >> xshift;
+ v_cur.y = points[n].y >> yshift;
+
+ area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x );
+
v_prev = v_cur;
}