From c8ffe090278f075c2a349db67a910b83f3a33007 Mon Sep 17 00:00:00 2001 From: erg Date: Wed, 2 Mar 2005 03:08:55 +0000 Subject: [PATCH] Fix bugs 183 and 247 --- lib/common/routespl.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/common/routespl.c b/lib/common/routespl.c index 3d19fffd3..7165cec65 100644 --- a/lib/common/routespl.c +++ b/lib/common/routespl.c @@ -157,12 +157,12 @@ point *routesplines(path * pp, int *npoints) printboxes(); if (debugleveln(3)) { psprintinit(1); - /* psprintboxes(boxes, boxn); */ + psprintboxes(boxes, boxn); } if (boxn * 8 > polypointn) { polypoints = ALLOC(boxn * 8, polypoints, Ppoint_t); - polypointn = pp->nbox * 8; + polypointn = boxn * 8; } if (realedge->tail != realedge->head) { @@ -186,7 +186,14 @@ point *routesplines(path * pp, int *npoints) polypoints[pi].x = boxes[bi].UR.x; polypoints[pi++].y = boxes[bi].UR.y; } - } else { + } + else if (prev == 0) { /* single box */ + polypoints[pi].x = boxes[bi].LL.x; + polypoints[pi++].y = boxes[bi].UR.y; + polypoints[pi].x = boxes[bi].LL.x; + polypoints[pi++].y = boxes[bi].LL.y; + } + else { if (!(prev == -1 && next == -1)) abort(); } @@ -198,7 +205,7 @@ point *routesplines(path * pp, int *npoints) if (bi > 0) next = (boxes[bi - 1].LL.y > boxes[bi].LL.y) ? 1 : -1; if (prev != next) { - if (next == -1 || prev == 1) { + if (next == -1 || prev == 1 ) { polypoints[pi].x = boxes[bi].LL.x; polypoints[pi++].y = boxes[bi].UR.y; polypoints[pi].x = boxes[bi].LL.x; @@ -209,7 +216,14 @@ point *routesplines(path * pp, int *npoints) polypoints[pi].x = boxes[bi].UR.x; polypoints[pi++].y = boxes[bi].UR.y; } - } else { + } + else if (prev == 0) { /* single box */ + polypoints[pi].x = boxes[bi].UR.x; + polypoints[pi++].y = boxes[bi].LL.y; + polypoints[pi].x = boxes[bi].UR.x; + polypoints[pi++].y = boxes[bi].UR.y; + } + else { if (!(prev == -1 && next == -1)) { /* it went badly, e.g. degenerate box in boxlist */ *npoints = 0; -- 2.40.0