diff options
author | Alexei Podtelezhnikov <apodtele@gmail.com> | 2023-02-20 16:33:45 +0000 |
---|---|---|
committer | Alexei Podtelezhnikov <apodtele@gmail.com> | 2023-02-20 16:33:45 +0000 |
commit | 34ed28d0fbf0552e0c0106007585e27fd163bf36 (patch) | |
tree | fbd7db8dd0d324c24254b7be11809c755cfe254d /src/smooth | |
parent | 713580f41dcc2054d7fa56265f03eeb9c67e0937 (diff) | |
download | freetype2-34ed28d0fbf0552e0c0106007585e27fd163bf36.tar.gz |
[base] Clean up contour indexing.
* src/base/ftoutln.c (FT_Outline_Reverse, FT_Outline_EmboldenXY,
FT_Outline_Get_Orientation): Set the first and last indexes together.
(FT_Outline_Decompose): Ditto and check them more stringently.
* src/smooth/ftgrays.c (FT_Outline_Decompose)[STANDALONE_]: Ditto.
Diffstat (limited to 'src/smooth')
-rw-r--r-- | src/smooth/ftgrays.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index d9f20eef1..05478f41c 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1666,6 +1666,8 @@ typedef ptrdiff_t FT_PtrDist; int n; /* index of contour in outline */ int first; /* index of first point in contour */ + int last; /* index of last point in contour */ + char tag; /* current point's state */ int shift; @@ -1680,18 +1682,17 @@ typedef ptrdiff_t FT_PtrDist; shift = func_interface->shift; delta = func_interface->delta; - first = 0; + last = -1; for ( n = 0; n < outline->n_contours; n++ ) { - int last; /* index of last point in contour */ - - - FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n )); + FT_TRACE5(( "FT_Outline_Decompose: Contour %d\n", n )); + first = last + 1; last = outline->contours[n]; - if ( last < 0 ) + if ( last < first ) goto Invalid_Outline; + limit = outline->points + last; v_start = outline->points[first]; @@ -1874,11 +1875,9 @@ typedef ptrdiff_t FT_PtrDist; v_start.x / 64.0, v_start.y / 64.0 )); error = func_interface->line_to( &v_start, user ); - Close: + Close: if ( error ) goto Exit; - - first = last + 1; } FT_TRACE5(( "FT_Outline_Decompose: Done\n", n )); |