From 3f01161ff22c84c371b6dc3b5e0351e0d6e8e771 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 21 Feb 2023 16:17:07 +0000 Subject: [PATCH] [raster] Clean up contour indexing. * src/raster/ftraster.c (Decompose_Curve, Convert_Glyph): Use consistent index types (Int) and compact iterations. --- src/raster/ftraster.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 67cbfd5d9..59b27a408 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -1742,9 +1742,9 @@ * SUCCESS on success, FAILURE on error. */ static Bool - Decompose_Curve( RAS_ARGS UShort first, - UShort last, - Int flipped ) + Decompose_Curve( RAS_ARGS Int first, + Int last, + Int flipped ) { FT_Vector v_last; FT_Vector v_control; @@ -1969,8 +1969,8 @@ static Bool Convert_Glyph( RAS_ARGS Int flipped ) { - Int i; - UInt start; + Int i; + Int first, last; ras.fProfile = NULL; @@ -1985,8 +1985,7 @@ ras.cProfile->offset = ras.top; ras.num_Profs = 0; - start = 0; - + last = -1; for ( i = 0; i < ras.outline.n_contours; i++ ) { PProfile lastProfile; @@ -1996,12 +1995,11 @@ ras.state = Unknown_State; ras.gProfile = NULL; - if ( Decompose_Curve( RAS_VARS (UShort)start, - (UShort)ras.outline.contours[i], - flipped ) ) - return FAILURE; + first = last + 1; + last = ras.outline.contours[i]; - start = (UShort)ras.outline.contours[i] + 1; + if ( Decompose_Curve( RAS_VARS first, last, flipped ) ) + return FAILURE; /* we must now check whether the extreme arcs join or not */ if ( FRAC( ras.lastY ) == 0 &&