allow usershapes to be rescaled by width, height when fixedsize=TRUE
authorellson <devnull@localhost>
Fri, 28 Sep 2007 19:05:14 +0000 (19:05 +0000)
committerellson <devnull@localhost>
Fri, 28 Sep 2007 19:05:14 +0000 (19:05 +0000)
lib/common/shapes.c

index 85d82ee9da525e8c3a5406d6528f1a590b4048c9..1f91a004c9eb7648219a9e05ba4da0a029ec4927 100644 (file)
@@ -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 : "<nil>"), 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 : "<nil>"), 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 */