From: Emden R. Gansner Date: Sun, 25 Oct 2015 19:50:21 +0000 (-0400) Subject: Reset saved node in three *_inside function before doing a layout. X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6570fb2da6cf82e56f1d0ca74834811ed8e4881d;p=graphviz Reset saved node in three *_inside function before doing a layout. --- diff --git a/lib/common/shapes.c b/lib/common/shapes.c index 0567e4569..6db30dec4 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -2246,9 +2246,16 @@ static boolean poly_inside(inside_t * inside_context, pointf p) int i, i1, j, s; pointf P, Q, R; - boxf *bp = inside_context->s.bp; - node_t *n = inside_context->s.n; + boxf *bp; + node_t *n; + if (!inside_context) { + lastn = NULL; + return FALSE; + } + + bp = inside_context->s.bp; + n = inside_context->s.n; P = ccwrotatepf(p, 90 * GD_rankdir(agraphof(n))); /* Quick test if port rectangle is target */ @@ -3029,8 +3036,14 @@ static boolean point_inside(inside_t * inside_context, pointf p) static node_t *lastn; /* last node argument */ static double radius; pointf P; - node_t *n = inside_context->s.n; + node_t *n; + if (!inside_context) { + lastn = NULL; + return FALSE; + } + + n = inside_context->s.n; P = ccwrotatepf(p, 90 * GD_rankdir(agraphof(n))); if (n != lastn) { @@ -3925,6 +3938,10 @@ static boolean star_inside(inside_t * inside_context, pointf p) static pointf *vertex; static pointf O; /* point (0,0) */ + if (!inside_context) { + lastn = NULL; + return FALSE; + } boxf *bp = inside_context->s.bp; node_t *n = inside_context->s.n; pointf P, Q, R; @@ -4086,3 +4103,12 @@ void resolvePorts(edge_t * e) ED_head_port(e) = resolvePort(aghead(e), agtail(e), &ED_head_port(e)); } + +void gv_initShapes() +{ + pointf p; + poly_inside(NULL, p); + point_inside(NULL, p); + star_inside(NULL, p); +} + diff --git a/lib/gvc/gvlayout.c b/lib/gvc/gvlayout.c index c1eb9a03d..aeeb4ad37 100644 --- a/lib/gvc/gvlayout.c +++ b/lib/gvc/gvlayout.c @@ -30,6 +30,7 @@ extern void graph_init(Agraph_t *g, boolean use_rankdir); extern void graph_cleanup(Agraph_t *g); extern void gv_fixLocale (int set); +extern void gv_initShapes (); int gvlayout_select(GVC_t * gvc, const char *layout) { @@ -81,6 +82,7 @@ int gvLayoutJobs(GVC_t * gvc, Agraph_t * g) gv_fixLocale (1); graph_init(g, gvc->layout.features->flags & LAYOUT_USES_RANKDIR); GD_drawing(agroot(g)) = GD_drawing(g); + gv_initShapes (); if (gvle && gvle->layout) { gvle->layout(g);