]> granicus.if.org Git - graphviz/commitdiff
compute a clip box in graph coords to enable clipping during emit
authorellson <devnull@localhost>
Thu, 30 Dec 2004 04:32:35 +0000 (04:32 +0000)
committerellson <devnull@localhost>
Thu, 30 Dec 2004 04:32:35 +0000 (04:32 +0000)
lib/common/emit.c
lib/gvc/gvrenderint.h

index 19a7b47afa1ec3c14d71f2ac147c37baf9de065f..1872ef0c347bf4daa0515d429d40b7bdeff51502 100644 (file)
@@ -364,8 +364,7 @@ void emit_node(GVC_t * gvc, node_t * n)
 
     if (ND_shape(n) == NULL)
        return;
-    if (node_in_layer(n->graph, n) && node_in_CB(n)
-       && (ND_state(n) != Page)) {
+    if (node_in_layer(n->graph, n) && node_in_CB(n) && (ND_state(n) != Page)) {
        gvrender_begin_node(gvc, n);
        if (((s = agget(n, "href")) && s[0])
            || ((s = agget(n, "URL")) && s[0])) {
@@ -685,6 +684,11 @@ void emit_graph(GVC_t * gvc, graph_t * g, int flags)
     /* FIXME - some of setup_pagination should be in emit_init() */
     setup_pagination(gvc, g);
 
+    gvc->clip.UR.x = ROUND(gvc->focus.x + (gvc->width+1) / (gvc->zoom * 2.));
+    gvc->clip.UR.y = ROUND(gvc->focus.y + (gvc->height+1) / (gvc->zoom * 2.));
+    gvc->clip.LL.x = ROUND(gvc->focus.x - (gvc->width+1) / (gvc->zoom * 2.));
+    gvc->clip.LL.y = ROUND(gvc->focus.y - (gvc->height+1) / (gvc->zoom * 2.));
+
     gvrender_begin_graph(gvc, g, PB, PFC);
     if (flags & EMIT_COLORS) {
        gvrender_set_fillcolor(gvc, DEFAULT_FILL);
index 6091d567266cc7466b658e8174f659aece387eea..613ceef259b8363b068ddab26e3a8c137d60955b 100644 (file)
@@ -137,6 +137,7 @@ extern "C" {
        double zoom;            /* viewport zoom factor */
        pointf focus;           /* viewport focus in graph units */
        pointf compscale;       /* composite device scale incl: scale, zoom, dpi, y_goes_down */
+       box clip;               /* clip region in graph units */
 
        /* gvrender_begin_page() */
        point page;