From eb37c5bc737d3df8a0e3b48e84893c4807de0ab0 Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Thu, 27 Mar 2014 15:31:51 -0400 Subject: [PATCH] Allow _draw_ as well as _background to describe graph background. --- lib/common/emit.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/lib/common/emit.c b/lib/common/emit.c index 5bb21f8c1..a87fdecce 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -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; } -- 2.40.0