From dde87984292bf32907a34052c2283497252eeb5f Mon Sep 17 00:00:00 2001 From: lecoanet Date: Thu, 14 Apr 2005 09:13:43 +0000 Subject: Fix a cumulative over-estimate of Curves bboxes (D.etienne) --- generic/Curve.c | 20 ++++++++++---------- generic/Geo.c | 10 ++++++++-- 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'generic') diff --git a/generic/Curve.c b/generic/Curve.c index 261f242..aa66b70 100644 --- a/generic/Curve.c +++ b/generic/Curve.c @@ -806,16 +806,6 @@ ComputeCoordinates(ZnItem item, } /* - * Add the line width in all directions. - * This overestimates the space needed to draw the polyline - * but is simple. - */ - item->item_bounding_box.orig.x -= lw; - item->item_bounding_box.orig.y -= lw; - item->item_bounding_box.corner.x += lw; - item->item_bounding_box.corner.y += lw; - - /* * Take care of miters, markers and arrows. */ c2 = cv->outlines.contours; @@ -868,6 +858,16 @@ ComputeCoordinates(ZnItem item, } /* + * Add the line width in all directions. + * This overestimates the space needed to draw the polyline + * but is simple. + */ + item->item_bounding_box.orig.x -= lw; + item->item_bounding_box.orig.y -= lw; + item->item_bounding_box.corner.x += lw; + item->item_bounding_box.corner.y += lw; + + /* * Expand again the bounding box by one pixel in all * directions to take care of rounding errors. */ diff --git a/generic/Geo.c b/generic/Geo.c index 52ac268..d93c5e9 100644 --- a/generic/Geo.c +++ b/generic/Geo.c @@ -439,8 +439,14 @@ ZnAddPointsToBBox(ZnBBox *bbox, } bbox->orig.x = x1; bbox->orig.y = y1; - bbox->corner.x = x2 + 1; - bbox->corner.y = y2 + 1; + if (x1 == x2) { + x2++; + } + if (y1 == y2) { + y2++; + } + bbox->corner.x = x2; + bbox->corner.y = y2; } -- cgit v1.1