From 9b450c4142005050f7cf329f9a27e6debfb1e738 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 29 Mar 2002 13:00:48 +0000 Subject: * Correction d'un core dump dans Clone. Les structures geometriques �taient mises � NULL pour �tre remplies par ComputeCoordinates. En fait il fallait les copier tout de suite. * Les flags sont dans un unsigned short (16 flags). * Adaptation de RenderPolyline (closed inutile). --- Bezier.c | 11 +++++++---- generic/Arc.c | 14 ++++++++++---- generic/Curve.c | 13 ++++++++----- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Bezier.c b/Bezier.c index 9b95d38..3ac35f5 100644 --- a/Bezier.c +++ b/Bezier.c @@ -70,7 +70,7 @@ typedef struct _BezierItemStruct { /* Public data */ ZnList points; - unsigned int flags; + unsigned short flags; ZnLineEnd first_end; /* These two are considered only if relief is flat */ ZnLineEnd last_end; LineStyle line_style; /* This is considered only if relief is flat */ @@ -257,9 +257,13 @@ Clone(Item item) char *text; bz->dev_points = NULL; - bz->grad_geo = NULL; bz->tristrip.num_strips = 0; + if (bz->grad_geo) { + ZnPoint *grad_geo = ZnMalloc(4*sizeof(ZnPoint)); + memcpy(grad_geo, bz->grad_geo, 4*sizeof(ZnPoint)); + bz->grad_geo = grad_geo; + } if (bz->gradient) { bz->gradient = ZnGetGradientByValue(bz->gradient); } @@ -962,8 +966,7 @@ Render(Item item) ZnLineEnd last = ISSET(bz->flags, LAST_END_OK) ? bz->last_end : NULL; RenderPolyline(wi, points, num_points, - bz->line_width, False, - bz->line_style, bz->cap_style, JoinRound, + bz->line_width, bz->line_style, bz->cap_style, JoinRound, first, last, bz->line_color); } } diff --git a/generic/Arc.c b/generic/Arc.c index 253aaef..9fdbc34 100644 --- a/generic/Arc.c +++ b/generic/Arc.c @@ -80,7 +80,7 @@ typedef struct _ArcItemStruct { ZnLineEnd first_end; ZnLineEnd last_end; char *tile_name; - unsigned char flags; + unsigned short flags; /* Private data */ ZnPoint orig; @@ -246,7 +246,11 @@ Clone(Item item) WidgetInfo *wi = item->wi; char *text; - arc->grad_geo = NULL; + if (arc->grad_geo) { + ZnPoint *grad_geo = ZnMalloc(4*sizeof(ZnPoint)); + memcpy(grad_geo, arc->grad_geo, 4*sizeof(ZnPoint)); + arc->grad_geo = grad_geo; + } if (arc->tile != ZnUnspecifiedImage) { text = ZnMalloc((strlen(arc->tile_name) + 1) * sizeof(char)); strcpy(text, arc->tile_name); @@ -270,7 +274,9 @@ Clone(Item item) } arc->line_color = ZnGetGradientByValue(arc->line_color); arc->fill_color = ZnGetGradientByValue(arc->fill_color); - arc->render_shape = NULL; + if (arc->render_shape) { + arc->render_shape = ZnListDuplicate(arc->render_shape); + } } @@ -1291,7 +1297,7 @@ Render(Item item) } } } - RenderPolyline(wi, p, num_points, arc->line_width, False, + RenderPolyline(wi, p, num_points, arc->line_width, arc->line_style, CapRound, JoinRound, first, last, arc->line_color); } diff --git a/generic/Curve.c b/generic/Curve.c index 9ea09de..79d7cf8 100644 --- a/generic/Curve.c +++ b/generic/Curve.c @@ -74,7 +74,7 @@ typedef struct _CurveItemStruct { /* Public data */ ZnPoly shape; - unsigned int flags; + unsigned short flags; Pixmap marker; ZnLineEnd first_end; /* These two are considered only if relief is flat */ ZnLineEnd last_end; @@ -297,7 +297,12 @@ Clone(Item item) ZnBool *holes; POLY_INIT(&cv->dev_shape); - cv->grad_geo = NULL; + + if (cv->grad_geo) { + ZnPoint *grad_geo = ZnMalloc(4*sizeof(ZnPoint)); + memcpy(grad_geo, cv->grad_geo, 4*sizeof(ZnPoint)); + cv->grad_geo = grad_geo; + } if (cv->shape.num_contours) { conts = cv->shape.contours; @@ -1304,14 +1309,12 @@ Render(Item item) else { ZnLineEnd first = ISSET(cv->flags, FIRST_END_OK) ? cv->first_end : NULL; ZnLineEnd last = ISSET(cv->flags, LAST_END_OK) ? cv->last_end : NULL; - ZnBool closed = ISSET(cv->flags, CLOSED_BIT); for (j = 0; j < cv->dev_shape.num_contours; j++) { RenderPolyline(wi, cv->dev_shape.contours[j].points, cv->dev_shape.contours[j].num_points, - cv->line_width, closed, - cv->line_style, cv->cap_style, cv->join_style, + cv->line_width, cv->line_style, cv->cap_style, cv->join_style, first, last, cv->line_color); } } -- cgit v1.1