From a695a1c7515502563c08dfb47dec9c0756b8c031 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 26 May 2000 08:38:23 +0000 Subject: Correction d'un bug emp�chant le fonctionnement de curves ne comportant qu'un point. Correction de la sous commande add de coords. Le nombre de points n'�tait pas augment�. Mise � jour de la structure de classe. --- generic/Curve.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/generic/Curve.c b/generic/Curve.c index 1a9be02..5ada355 100644 --- a/generic/Curve.c +++ b/generic/Curve.c @@ -587,7 +587,7 @@ ReduceContours(ZnPoly *poly_in, ZnContour *c; ZnBool *hole; ZnPoly cpoly, rpoly; - + POLY_INIT(poly_out); for (i = 0, hole = poly_in->holes, c = poly_in->contours; i < poly_in->num_contours; i++, c++, hole++) { @@ -634,7 +634,6 @@ ComputeCoordinates(Item item, } else if (ISCLEAR(cv->flags, REDUCED_BIT)) { ZnPoly poly; - printf("Contour reduction\n"); ReduceContours(&cv->shape, &poly); POLY_SET(&cv->shape, &poly); SET(cv->flags, REDUCED_BIT); @@ -670,7 +669,8 @@ ComputeCoordinates(Item item, * the first. */ if ((c1->points[0].x == c1->points[c1->num_points-1].x) && - (c1->points[0].y == c1->points[c1->num_points-1].y)) { + (c1->points[0].y == c1->points[c1->num_points-1].y) && + (c1->num_points != 1)) { c1->num_points--; } c2->num_points = c1->num_points; @@ -840,16 +840,16 @@ ToArea(Item item, if (!first_done) { first_done = True; result = PolygonInBBox(points, num_points, area, &area_enclosed); - printf("contour %d, result %d, area_enclosed %d\n", - i, result, area_enclosed); + /*printf("contour %d, result %d, area_enclosed %d\n", + i, result, area_enclosed);*/ if (cv->shape.holes[i] && area_enclosed) { return -1; } } else { result2 = PolygonInBBox(points, num_points, area, &area_enclosed); - printf("contour %d, result %d, area_enclosed %d\n", - i, result2, area_enclosed); + /*printf("contour %d, result %d, area_enclosed %d\n", + i, result2, area_enclosed);*/ if (cv->shape.holes[i] && area_enclosed) { return -1; } @@ -1495,6 +1495,7 @@ Coords(Item item, for (i = 0; i < *num_pts; i++, index++) { c->points[index] = (*pts)[i]; } + c->num_points += *num_pts; CLEAR(cv->flags, REDUCED_BIT); ITEM.Invalidate(item, ZN_COORDS_FLAG); } @@ -1573,6 +1574,11 @@ static ItemClassStruct CURVE_ITEM_CLASS = { NULL, /* GetAnchor */ GetClipVertices, Coords, + NULL, /* InsertChars */ + NULL, /* DeleteChars */ + NULL, /* Cursor */ + NULL, /* Index */ + NULL, /* Selection */ Contour, ComputeCoordinates, ToArea, -- cgit v1.1