]> granicus.if.org Git - graphviz/commitdiff
fixing -Txdot -y support
authorellson <devnull@localhost>
Mon, 6 Nov 2006 23:59:18 +0000 (23:59 +0000)
committerellson <devnull@localhost>
Mon, 6 Nov 2006 23:59:18 +0000 (23:59 +0000)
lib/common/globals.h
lib/common/macros.h
lib/common/output.c
plugin/core/gvrender_core_dot.c

index 3a6cbfbd5a026191e438fd31d7227103c59faebf..e466ebd726602f06129548e2b1c80bc6f6b78496 100644 (file)
@@ -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,
index ae6426611b2fa15db18557ec4978db1e2cfc669b..e1cae9eb8d58bbe1639d7fe82d1127e21ea9863b 100644 (file)
@@ -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
index 2c95c896d328f4f41ca158fcee34afb670678f08..b4f076852f4773a6bfa6de9f74aeef8b26ef35da 100644 (file)
 #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);
+}
+
index 03654bc42f36d93ec9acc1b9f4d32ac91b85b1e3..ef08380fc5658cdaffda6dbf6a72dd05d4ed7f6f 100644 (file)
@@ -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);
 }