]> granicus.if.org Git - graphviz/commitdiff
back out previous - committed by mistake
authorellson <devnull@localhost>
Fri, 7 Jul 2006 15:35:19 +0000 (15:35 +0000)
committerellson <devnull@localhost>
Fri, 7 Jul 2006 15:35:19 +0000 (15:35 +0000)
lib/gvc/gvrender.c

index 2cbbad3b4a6809fba5beb8b8ccbe6334ee235868..7df77e0b8cf0257eeaaa73ba7fe3db7c9b30fd83 100644 (file)
@@ -364,6 +364,8 @@ static void gvrender_resolve_color(gvrender_features_t * features,
     }
 }
 
+#define EPSILON .0001
+
 void gvrender_begin_graph(GVJ_t * job, graph_t * g)
 {
     GVC_t *gvc = job->gvc;
@@ -371,6 +373,10 @@ void gvrender_begin_graph(GVJ_t * job, graph_t * g)
     gvrender_engine_t *gvre = job->render.engine;
     textlabel_t *lab;
     char *s;
+    double sx, sy;
+
+    sx = job->width / (job->zoom * 2.);
+    sy = job->height / (job->zoom * 2.);
 
     obj = push_obj_state(job);
     obj->g = g;
@@ -384,6 +390,25 @@ void gvrender_begin_graph(GVJ_t * job, graph_t * g)
         obj->url = strdup_and_subst_graph(s, g);
     } 
 
+    job->compscale.x = job->scale.x = job->zoom * job->dpi.x / POINTS_PER_INCH;
+    job->compscale.y = job->scale.y = job->zoom * job->dpi.y / POINTS_PER_INCH;
+    job->compscale.y *= (job->flags & GVRENDER_Y_GOES_DOWN) ? -1. : 1.;
+    if (job->rotation) {
+        job->clip.UR.x = job->focus.x + sy + EPSILON;
+        job->clip.UR.y = job->focus.y + sx + EPSILON;
+        job->clip.LL.x = job->focus.x - sy - EPSILON;
+        job->clip.LL.y = job->focus.y - sx - EPSILON;
+       job->offset.x = -job->focus.y * job->compscale.x + job->width * 3 / 2;
+       job->offset.y = -job->focus.x * job->compscale.y + job->height / 2.;
+    } else {
+        job->clip.UR.x = job->focus.x + sx + EPSILON;
+        job->clip.UR.y = job->focus.y + sy + EPSILON;
+        job->clip.LL.x = job->focus.x - sx - EPSILON;
+        job->clip.LL.y = job->focus.y - sy - EPSILON;
+       job->offset.x = -job->focus.x * job->compscale.x + job->width / 2.;
+       job->offset.y = -job->focus.y * job->compscale.y + job->height / 2.;
+    }
+
     /* init stack */
     gvc->SP = 0;
     job->style = &(gvc->styles[0]);