]> granicus.if.org Git - graphviz/commitdiff
Allow _draw_ as well as _background to describe graph background.
authorEmden R. Gansner <erg@research.att.com>
Thu, 27 Mar 2014 19:31:51 +0000 (15:31 -0400)
committerEmden R. Gansner <erg@research.att.com>
Thu, 27 Mar 2014 19:31:51 +0000 (15:31 -0400)
lib/common/emit.c

index 5bb21f8c161269100413a4dae0c0bd53e61a592a..a87fdecce0eff71d64822ab6a26e8e675470d768 100644 (file)
@@ -48,32 +48,35 @@ void* init_xdot (Agraph_t* g)
     char* p;
     xdot* xd = NULL;
 
-    if ((p = agget(g, "_background")) && p[0]) {
-#ifdef DEBUG
-       if (Verbose) {
-           start_timer();
+    if (!((p = agget(g, "_background")) && p[0])) {
+       if (!((p = agget(g, "_draw_")) && p[0])) {
+           return NULL;
        }
+    }
+#ifdef DEBUG
+    if (Verbose) {
+       start_timer();
+    }
 #endif
-       xd = parseXDotF (p, NULL, sizeof (exdot_op));
+    xd = parseXDotF (p, NULL, sizeof (exdot_op));
 
-       if (!xd) {
-           agerr(AGWARN, "Could not parse \"_background\" attribute in graph %s\n", agnameof(g));
-           agerr(AGPREV, "  \"%s\"\n", p);
-       }
+    if (!xd) {
+       agerr(AGWARN, "Could not parse \"_background\" attribute in graph %s\n", agnameof(g));
+       agerr(AGPREV, "  \"%s\"\n", p);
+    }
 #ifdef DEBUG
-       if (Verbose) {
-           xdot_stats stats;
-           double et = elapsed_sec();
-           statXDot (xd, &stats);
-           fprintf (stderr, "%d ops %.2f sec\n", stats.cnt, et);
-           fprintf (stderr, "%d polygons %d points\n", stats.n_polygon, stats.n_polygon_pts);
-           fprintf (stderr, "%d polylines %d points\n", stats.n_polyline, stats.n_polyline_pts);
-           fprintf (stderr, "%d beziers %d points\n", stats.n_bezier, stats.n_bezier_pts);
-           fprintf (stderr, "%d ellipses\n", stats.n_ellipse);
-           fprintf (stderr, "%d texts\n", stats.n_text);
-       }
-#endif
+    if (Verbose) {
+       xdot_stats stats;
+       double et = elapsed_sec();
+       statXDot (xd, &stats);
+       fprintf (stderr, "%d ops %.2f sec\n", stats.cnt, et);
+       fprintf (stderr, "%d polygons %d points\n", stats.n_polygon, stats.n_polygon_pts);
+       fprintf (stderr, "%d polylines %d points\n", stats.n_polyline, stats.n_polyline_pts);
+       fprintf (stderr, "%d beziers %d points\n", stats.n_bezier, stats.n_bezier_pts);
+       fprintf (stderr, "%d ellipses\n", stats.n_ellipse);
+       fprintf (stderr, "%d texts\n", stats.n_text);
     }
+#endif
     return xd;
 }