From: ellson Date: Mon, 6 Nov 2006 23:59:18 +0000 (+0000) Subject: fixing -Txdot -y support X-Git-Tag: LAST_LIBGRAPH~32^2~5817 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ba331b0e48b4daea29e52dd51dcff769594b0b0;p=graphviz fixing -Txdot -y support --- diff --git a/lib/common/globals.h b/lib/common/globals.h index 3a6cbfbd5..e466ebd72 100644 --- a/lib/common/globals.h +++ b/lib/common/globals.h @@ -83,8 +83,6 @@ extern "C" { EXTERN double Initial_dist; EXTERN double Damping; EXTERN int Y_invert; /* invert y in dot & plain output */ - EXTERN int Y_off; /* ymin + ymax */ - EXTERN double YF_off; /* Y_off in inches */ EXTERN attrsym_t *G_activepencolor, *G_activefillcolor, diff --git a/lib/common/macros.h b/lib/common/macros.h index ae6426611..e1cae9eb8 100644 --- a/lib/common/macros.h +++ b/lib/common/macros.h @@ -42,7 +42,4 @@ ((side & 0x8) ? BOTTOM : (side << 1)) : \ ((side & 0x1) ? LEFT : (side >> 1))) -#define YDIR(y) (Y_invert ? (Y_off - (y)) : (y)) -#define YFDIR(y) (Y_invert ? (YF_off - (y)) : (y)) - #endif diff --git a/lib/common/output.c b/lib/common/output.c index 2c95c896d..b4f076852 100644 --- a/lib/common/output.c +++ b/lib/common/output.c @@ -17,6 +17,11 @@ #include "render.h" #include "agxbuf.h" +#define YDIR(y) (Y_invert ? (Y_off - (y)) : (y)) +#define YFDIR(y) (Y_invert ? (YF_off - (y)) : (y)) + +int Y_off; /* ymin + ymax */ +double YF_off; /* Y_off in inches */ static void printptf(FILE * f, point pt) { @@ -306,3 +311,10 @@ void attach_attrs(graph_t * g) attach_attrs_and_arrows (g, &s, &e); } +void output_point(agxbuf *xbuf, pointf p) +{ + char buf[BUFSIZ]; + sprintf(buf, "%d %d ", ROUND(p.x), YDIR(ROUND(p.y))); + agxbput(xbuf, buf); +} + diff --git a/plugin/core/gvrender_core_dot.c b/plugin/core/gvrender_core_dot.c index 03654bc42..ef08380fc 100644 --- a/plugin/core/gvrender_core_dot.c +++ b/plugin/core/gvrender_core_dot.c @@ -39,6 +39,7 @@ extern void attach_attrs(graph_t * g); extern void attach_attrs_and_arrows(graph_t*, int*, int*); extern char *xml_string(char *str); extern void write_plain(GVJ_t * job, graph_t * g, FILE * f, bool extend); +extern void output_point(agxbuf *xbuf, pointf p); #define GNEW(t) (t*)malloc(sizeof(t)) @@ -94,10 +95,8 @@ static void xdot_points(GVJ_t *job, char c, pointf * A, int n) rc = agxbputc(xbufs[emit_state], c); sprintf(buf, " %d ", n); agxbput(xbufs[emit_state], buf); - for (i = 0; i < n; i++) { - sprintf(buf, "%d %d ", ROUND(A[i].x), ROUND(A[i].y)); - agxbput(xbufs[emit_state], buf); - } + for (i = 0; i < n; i++) + output_point(xbufs[emit_state], A[i]); } static void xdot_pencolor (GVJ_t *job) @@ -336,7 +335,9 @@ static void xdot_textpara(GVJ_t * job, pointf p, textpara_t * para) j = 0; break; } - sprintf(buf, "T %d %d %d %d ", ROUND(p.x), ROUND(p.y), j, (int) para->width); + agxbput(xbufs[emit_state], "T "); + output_point(xbufs[emit_state], p); + sprintf(buf, "%d %d ", j, (int) para->width); agxbput(xbufs[emit_state], buf); xdot_str (job, "", para->str); } @@ -346,18 +347,17 @@ static void xdot_ellipse(GVJ_t * job, pointf * A, int filled) emit_state_t emit_state = job->obj->emit_state; char buf[BUFSIZ]; - int rc; xdot_style (job); xdot_pencolor (job); if (filled) { xdot_fillcolor (job); - rc = agxbputc(xbufs[emit_state], 'E'); + agxbput(xbufs[emit_state], "E "); } else - rc = agxbputc(xbufs[emit_state], 'e'); - sprintf(buf, " %d %d %d %d ", - ROUND(A[0].x), ROUND(A[0].y), ROUND(A[1].x - A[0].x), ROUND(A[1].y - A[0].y)); + agxbput(xbufs[emit_state], "e "); + output_point(xbufs[emit_state], A[0]); + sprintf(buf, " %d %d ", ROUND(A[1].x - A[0].x), ROUND(A[1].y - A[0].y)); agxbput(xbufs[emit_state], buf); }