From cd54e9bf89def1d5e320142972dc53db91ee2bb5 Mon Sep 17 00:00:00 2001 From: ellson Date: Fri, 28 Sep 2007 19:05:14 +0000 Subject: [PATCH] allow usershapes to be rescaled by width, height when fixedsize=TRUE --- lib/common/shapes.c | 47 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/common/shapes.c b/lib/common/shapes.c index 85d82ee9d..1f91a004c 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -499,6 +499,7 @@ boolean isPolygon(node_t * n) static void poly_init(node_t * n) { pointf dimen, bb; + point imagesize; pointf P, Q, R; pointf *vertices; char *p; @@ -570,36 +571,34 @@ static void poly_init(node_t * n) PAD(dimen); } + imagesize.x = imagesize.y = 0; + if (ND_shape(n)->usershape) { + /* custom requires a shapefile + * not custom is an adaptable user shape such as a postscript + * function. + */ + if (streq(ND_shape(n)->name, "custom")) { + char *sfile = agget(n, "shapefile"); + imagesize = gvusershape_size(n->graph, sfile); + if ((imagesize.x == -1) && (imagesize.y == -1)) { + agerr(AGWARN, + "No or improper shapefile=\"%s\" for node \"%s\"\n", + (sfile ? sfile : ""), n->name); + imagesize.x = imagesize.y = 0; + } else + GD_has_images(n->graph) = TRUE; + } + } if (mapbool(late_string(n, N_fixed, "false"))) { if ((width < dimen.x) || (height < dimen.y)) agerr(AGWARN, "node '%s', graph '%s' size too small for label\n", n->name, n->graph->name); dimen.x = dimen.y = 0; - } else { - if (ND_shape(n)->usershape) { - point imagesize; - - /* custom requires a shapefile - * not custom is an adaptable user shape such as a postscript - * function. - */ - if (streq(ND_shape(n)->name, "custom")) { - char *sfile = agget(n, "shapefile"); - imagesize = gvusershape_size(n->graph, sfile); - if ((imagesize.x == -1) && (imagesize.y == -1)) { - agerr(AGWARN, - "No or improper shapefile=\"%s\" for node \"%s\"\n", - (sfile ? sfile : ""), n->name); - } else - GD_has_images(n->graph) = TRUE; - } - else { - imagesize.x = imagesize.y = 0; - } - dimen.x = MAX(dimen.x, imagesize.x+2); - dimen.y = MAX(dimen.y, imagesize.y+2); - } + } + else { + dimen.x = MAX(dimen.x, imagesize.x+2); + dimen.y = MAX(dimen.y, imagesize.y+2); } /* quantization */ -- 2.40.0