]> granicus.if.org Git - graphviz/commitdiff
merge style stack into obj_state stack
authorellson <devnull@localhost>
Tue, 1 Aug 2006 01:49:43 +0000 (01:49 +0000)
committerellson <devnull@localhost>
Tue, 1 Aug 2006 01:49:43 +0000 (01:49 +0000)
lib/common/emit.c
lib/gvc/gvcint.h
lib/gvc/gvcjob.h
lib/gvc/gvrender.c
plugin/core/gvrender_core_fig.c
plugin/core/gvrender_core_ps.c
plugin/core/gvrender_core_svg.c
plugin/gd/gvrender_gd.c
plugin/gd/gvrender_gd_vrml.c
plugin/pango/gvrender_pango.c

index 6ba83d79dea7ed1fd37d447916c45399a59d5263..3313488660ad2b07e441e582dbb11e052f070cf8 100644 (file)
@@ -37,14 +37,27 @@ static char *defaultlinestyle[3] = { "solid\0", "setlinewidth\0001\0", 0 };
 /* push empty graphic state for current object */
 static obj_state_t* push_obj_state(GVJ_t *job)
 {
-    obj_state_t *obj;
+    obj_state_t *obj, *parent;
 
     if (! (obj = zmalloc(sizeof(obj_state_t))))
         agerr(AGERR, "no memory from zmalloc()\n");
 
-    obj->parent = job->obj;
+    parent = obj->parent = job->obj;
     job->obj = obj;
-
+    if (parent) {
+        obj->pencolor = parent->pencolor;        /* default styles to parent's style */
+        obj->fillcolor = parent->fillcolor;
+        obj->pen = parent->pen;
+        obj->fill = parent->fill;
+        obj->penwidth = parent->penwidth;
+    }
+    else {
+       /* obj->pencolor = NULL */
+       /* obj->fillcolor = NULL */
+       obj->pen = PEN_SOLID;
+       obj->fill = FILL_NONE;
+       obj->penwidth = PENWIDTH_NORMAL;
+    }
     return obj;
 }
 
@@ -1114,12 +1127,12 @@ static void emit_node(GVJ_t * job, node_t * n)
     GVC_t *gvc = job->gvc;
     char *s;
 
-    if (ND_shape(n) == NULL)
-       return;
-
-    if (node_in_layer(job, n->graph, n)
-           && node_in_box(n, job->pageBoxClip)
-           && (ND_state(n) != gvc->common.viewNum)) {
+    if (ND_shape(n)                                 /* node has a shape */
+           && node_in_layer(job, n->graph, n)       /* and is in layer */
+           && node_in_box(n, job->pageBoxClip)      /* and is in page  */
+           && (ND_state(n) != gvc->common.viewNum)) /* and not already drawn */
+    {
+       ND_state(n) = gvc->common.viewNum;           /* mark node as drawn */
 
         gvrender_comment(job, n->name);
        s = late_string(n, N_comment, "");
@@ -1128,7 +1141,6 @@ static void emit_node(GVJ_t * job, node_t * n)
         
        emit_begin_node(job, n);
        ND_shape(n)->fns->codefn(job, n);
-       ND_state(n) = gvc->common.viewNum;
        emit_end_node(job);
     }
 }
@@ -1706,26 +1718,26 @@ static void emit_edge(GVJ_t * job, edge_t * e)
 {
     char *s;
 
-    if (! edge_in_box(e, job->pageBoxClip) || ! edge_in_layer(job, e->head->graph, e))
-       return;
+    if (edge_in_box(e, job->pageBoxClip) && edge_in_layer(job, e->head->graph, e)) {
 
-    s = malloc(strlen(e->tail->name) + 2 + strlen(e->head->name) + 1);
-    strcpy(s,e->tail->name);
-    if (AG_IS_DIRECTED(e->tail->graph))
-        strcat(s,"->");
-    else
-        strcat(s,"--");
-    strcat(s,e->head->name);
-    gvrender_comment(job, s);
-    free(s);
+       s = malloc(strlen(e->tail->name) + 2 + strlen(e->head->name) + 1);
+       strcpy(s,e->tail->name);
+       if (AG_IS_DIRECTED(e->tail->graph))
+           strcat(s,"->");
+       else
+           strcat(s,"--");
+       strcat(s,e->head->name);
+       gvrender_comment(job, s);
+       free(s);
 
-    s = late_string(e, E_comment, "");
-    if (s[0])
-        gvrender_comment(job, s);
+       s = late_string(e, E_comment, "");
+       if (s[0])
+           gvrender_comment(job, s);
 
-    emit_begin_edge(job, e);
-    emit_edge_graphics (job, e);
-    emit_end_edge(job);
+       emit_begin_edge(job, e);
+       emit_edge_graphics (job, e);
+       emit_end_edge(job);
+    }
 }
 
 static void init_gvc(GVC_t * gvc, graph_t * g)
@@ -2039,7 +2051,6 @@ void emit_view(GVJ_t * job, graph_t * g, int flags)
 
 static void emit_begin_graph(GVJ_t * job, graph_t * g)
 {
-    GVC_t *gvc = job->gvc;
     int flags = job->flags;
     obj_state_t *obj;
     textlabel_t *lab;
@@ -2075,13 +2086,6 @@ static void emit_begin_graph(GVJ_t * job, graph_t * g)
         obj->target = strdup_and_subst_graph(s, g);
     }
 
-    /* init stack */
-    gvc->SP = 0;
-    job->style = &(gvc->styles[0]);
-    job->style->pen = PEN_SOLID;
-    job->style->fill = FILL_NONE;
-    job->style->penwidth = PENWIDTH_NORMAL;
-
 #ifdef WITH_CODEGENS
     Obj = NONE;
 #endif
index ae251fd8bbb58f563a390053686801b44ab53899..fcdf99837ebdf9a29169ee32745a611305968592 100644 (file)
@@ -130,9 +130,6 @@ extern "C" {
        /* default line style */
        char **defaultlinestyle;
 
-       gvstyle_t styles[MAXNEST]; /* style stack - reused by each job */
-       int SP;
-
        /* render defaults set from graph */
        gvcolor_t bgcolor;      /* background color */
     };
index f711e71efb53250d57bc9b765061b68cf68f9769..65ee90fa3a7d555055368642cde9b66f2f2832d1 100644 (file)
@@ -40,14 +40,6 @@ extern "C" {
 #define PENWIDTH_BOLD 2.
     typedef enum { GVATTR_STRING, GVATTR_BOOL, GVATTR_COLOR } gvattr_t;
 
-    typedef struct {
-       gvcolor_t pencolor, fillcolor;
-       pen_type pen;
-       fill_type fill;
-       double penwidth;
-       char **rawstyle;
-    } gvstyle_t;
-
 #define EMIT_SORTED (1<<0)
 #define EMIT_COLORS (1<<1)
 #define EMIT_CLUSTERS_LAST (1<<2)
@@ -151,6 +143,12 @@ extern "C" {
 
        int oldstate;  /* FIXME - used by one of those other state stacks */
 
+       gvcolor_t pencolor, fillcolor;
+       pen_type pen;
+       fill_type fill;
+       double penwidth;
+       char **rawstyle;
+
        double z, tail_z, head_z;   /* z depths for 2.5D renderers such as vrml */
 
        /* fully substituted text strings */
@@ -232,8 +230,6 @@ extern "C" {
        void *surface;          /* gd or cairo surface */
        bool external_surface;  /* surface belongs to caller */
 
-       gvstyle_t *style;       /* active style from gvc->styles[] */
-
         int flags;             /* emit_graph flags */
 
        int numLayers;          /* number of layers */
index 2b5b3ac7a4740d1782dd2823e34f5eb52e4bef15..af85b61f20889ef5624a6a722c24041fee48ef01 100644 (file)
@@ -608,42 +608,21 @@ void gvrender_end_edge(GVJ_t * job)
 
 void gvrender_begin_context(GVJ_t * job)
 {
-    GVC_t *gvc = job->gvc;
-    gvrender_engine_t *gvre = job->render.engine;
-
-    if (gvre) {
-       (gvc->SP)++;
-       assert((gvc->SP) < MAXNEST);
-       gvc->styles[gvc->SP] = gvc->styles[(gvc->SP) - 1];
-       job->style = &(gvc->styles[gvc->SP]);
-    }
 #ifdef WITH_CODEGENS
-    else {
-       codegen_t *cg = job->codegen;
+    codegen_t *cg = job->codegen;
 
-       if (cg && cg->begin_context)
-           cg->begin_context();
-    }
+    if (cg && cg->begin_context)
+       cg->begin_context();
 #endif
 }
 
 void gvrender_end_context(GVJ_t * job)
 {
-    GVC_t *gvc = job->gvc;
-    gvrender_engine_t *gvre = job->render.engine;
-
-    if (gvre) {
-       gvc->SP--;
-       assert(gvc->SP >= 0);
-       job->style = &(gvc->styles[gvc->SP]);
-    }
 #ifdef WITH_CODEGENS
-    else {
-       codegen_t *cg = job->codegen;
+    codegen_t *cg = job->codegen;
 
-       if (cg && cg->end_context)
-           cg->end_context();
-    }
+    if (cg && cg->end_context)
+       cg->end_context();
 #endif
 }
 
@@ -703,8 +682,8 @@ void gvrender_textpara(GVJ_t * job, pointf p, textpara_t * para)
     pointf PF;
 
     if (para->str && para->str[0]
-           && ( ! job->style  /* because of xdgen non-conformity */
-               || job->style->pen != PEN_NONE)) {
+           && ( ! job->obj  /* because of xdgen non-conformity */
+               || job->obj->pen != PEN_NONE)) {
        if (job->flags & GVRENDER_DOES_TRANSFORM)
            PF = p;
        else
@@ -729,7 +708,7 @@ void gvrender_textpara(GVJ_t * job, pointf p, textpara_t * para)
 void gvrender_set_pencolor(GVJ_t * job, char *name)
 {
     gvrender_engine_t *gvre = job->render.engine;
-    gvcolor_t *color = &(job->style->pencolor);
+    gvcolor_t *color = &(job->obj->pencolor);
 
     if (gvre) {
        gvrender_resolve_color(job->render.features, name, color);
@@ -749,7 +728,7 @@ void gvrender_set_pencolor(GVJ_t * job, char *name)
 void gvrender_set_fillcolor(GVJ_t * job, char *name)
 {
     gvrender_engine_t *gvre = job->render.engine;
-    gvcolor_t *color = &(job->style->fillcolor);
+    gvcolor_t *color = &(job->obj->fillcolor);
 
     if (gvre) {
        gvrender_resolve_color(job->render.features, name, color);
@@ -769,31 +748,31 @@ void gvrender_set_fillcolor(GVJ_t * job, char *name)
 void gvrender_set_style(GVJ_t * job, char **s)
 {
     gvrender_engine_t *gvre = job->render.engine;
+    obj_state_t *obj = job->obj;
     char *line, *p;
-    gvstyle_t *style = job->style;
 
-    job->style->rawstyle = s;
+    obj->rawstyle = s;
     if (gvre) {
        while ((p = line = *s++)) {
            if (streq(line, "solid"))
-               style->pen = PEN_SOLID;
+               obj->pen = PEN_SOLID;
            else if (streq(line, "dashed"))
-               style->pen = PEN_DASHED;
+               obj->pen = PEN_DASHED;
            else if (streq(line, "dotted"))
-               style->pen = PEN_DOTTED;
+               obj->pen = PEN_DOTTED;
            else if (streq(line, "invis") || streq(line, "invisible"))
-               style->pen = PEN_NONE;
+               obj->pen = PEN_NONE;
            else if (streq(line, "bold"))
-               style->penwidth = PENWIDTH_BOLD;
+               obj->penwidth = PENWIDTH_BOLD;
            else if (streq(line, "setlinewidth")) {
                while (*p)
                    p++;
                p++;
-               style->penwidth = atof(p);
+               obj->penwidth = atof(p);
            } else if (streq(line, "filled"))
-               style->fill = FILL_SOLID;
+               obj->fill = FILL_SOLID;
            else if (streq(line, "unfilled"))
-               style->fill = FILL_NONE;
+               obj->fill = FILL_NONE;
            else {
                agerr(AGWARN,
                      "gvrender_set_style: unsupported style %s - ignoring\n",
@@ -816,7 +795,7 @@ void gvrender_ellipse(GVJ_t * job, pointf pf, double rx, double ry, bool filled)
     gvrender_engine_t *gvre = job->render.engine;
 
     if (gvre) {
-       if (gvre->ellipse && job->style->pen != PEN_NONE) {
+       if (gvre->ellipse && job->obj->pen != PEN_NONE) {
            pointf af[2];
 
            /* center */
@@ -849,7 +828,7 @@ void gvrender_polygon(GVJ_t * job, pointf * af, int n, bool filled)
     gvrender_engine_t *gvre = job->render.engine;
 
     if (gvre) {
-       if (gvre->polygon && job->style->pen != PEN_NONE) {
+       if (gvre->polygon && job->obj->pen != PEN_NONE) {
            if (job->flags & GVRENDER_DOES_TRANSFORM)
                gvre->polygon(job, af, n, filled);
            else {
@@ -899,7 +878,7 @@ void gvrender_beziercurve(GVJ_t * job, pointf * af, int n,
     gvrender_engine_t *gvre = job->render.engine;
 
     if (gvre) {
-       if (gvre->beziercurve && job->style->pen != PEN_NONE) {
+       if (gvre->beziercurve && job->obj->pen != PEN_NONE) {
            if (job->flags & GVRENDER_DOES_TRANSFORM)
                gvre->beziercurve(job, af, n, arrow_at_start, arrow_at_end,filled);
            else {
@@ -934,7 +913,7 @@ void gvrender_polyline(GVJ_t * job, pointf * af, int n)
     gvrender_engine_t *gvre = job->render.engine;
 
     if (gvre) {
-       if (gvre->polyline && job->style->pen != PEN_NONE) {
+       if (gvre->polyline && job->obj->pen != PEN_NONE) {
            if (job->flags & GVRENDER_DOES_TRANSFORM)
                gvre->polyline(job, af, n);
             else {
index 54013c6fef5d27d7b559d7022a8c0790969e4cfe..e5cd635ba98d07143c4a6e67917684a39a9cba1f 100644 (file)
@@ -200,9 +200,9 @@ static void figgen_resolve_color(GVJ_t *job, gvcolor_t * color)
     color->type = COLOR_INDEX;
 }
 
-static void figgen_line_style(gvstyle_t *style, int *line_style, double *style_val)
+static void figgen_line_style(obj_state_t *obj, int *line_style, double *style_val)
 {
-    switch (style->pen) {
+    switch (obj->pen) {
        case PEN_DASHED: 
            *line_style = 1;
            *style_val = 10.;
@@ -277,11 +277,11 @@ static void figgen_end_edge(GVJ_t * job)
 
 static void figgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
 
     int object_code = 4;        /* always 4 for text */
     int sub_type = 0;           /* text justification */
-    int color = style->pencolor.u.index;
+    int color = obj->pencolor.u.index;
     int depth = Depth;
     int pen_style = 0;          /* not used */
     int font = -1;             /* init to xfig's default font */
@@ -316,14 +316,14 @@ static void figgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 
 static void figgen_ellipse(GVJ_t * job, pointf * A, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
 
     int object_code = 1;        /* always 1 for ellipse */
     int sub_type = 1;           /* ellipse defined by radii */
     int line_style;            /* solid, dotted, dashed */
-    int thickness = style->penwidth;
-    int pen_color = style->pencolor.u.index;
-    int fill_color = style->fillcolor.u.index;
+    int thickness = obj->penwidth;
+    int pen_color = obj->pencolor.u.index;
+    int fill_color = obj->fillcolor.u.index;
     int depth = Depth;
     int pen_style = 0;          /* not used */
     int area_fill = filled ? 20 : -1;
@@ -333,7 +333,7 @@ static void figgen_ellipse(GVJ_t * job, pointf * A, int filled)
     int center_x, center_y, radius_x, radius_y;
     int start_x, start_y, end_x, end_y;
 
-    figgen_line_style(style, &line_style, &style_val);
+    figgen_line_style(obj, &line_style, &style_val);
 
     start_x = center_x = ROUND(A[0].x);
     start_y = center_y = ROUND(A[0].y);
@@ -350,18 +350,17 @@ static void figgen_ellipse(GVJ_t * job, pointf * A, int filled)
             start_y, end_x, end_y);
 }
 
-static void
-figgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
+static void figgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
              int arrow_at_end, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
 
     int object_code = 3;        /* always 3 for spline */
     int sub_type;
     int line_style;            /* solid, dotted, dashed */
-    int thickness = style->penwidth;
-    int pen_color = style->pencolor.u.index;
-    int fill_color = style->fillcolor.u.index;
+    int thickness = obj->penwidth;
+    int pen_color = obj->pencolor.u.index;
+    int fill_color = obj->fillcolor.u.index;
     int depth = Depth;
     int pen_style = 0;          /* not used */
     int area_fill;
@@ -385,12 +384,12 @@ figgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
                                 1) * 20 * sizeof(char));
     buf = buffer;
 
-    figgen_line_style(style, &line_style, &style_val);
+    figgen_line_style(obj, &line_style, &style_val);
 
     if (filled) {
         sub_type = 5;     /* closed X-spline */
         area_fill = 20;   /* fully saturated color */
-        fill_color = job->style->fillcolor.u.index;
+        fill_color = job->obj->fillcolor.u.index;
     }
     else {
         sub_type = 4;     /* opened X-spline */
@@ -442,14 +441,14 @@ figgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
 
 static void figgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
 
     int object_code = 2;        /* always 2 for polyline */
     int sub_type = 3;           /* always 3 for polygon */
     int line_style;            /* solid, dotted, dashed */
-    int thickness = style->penwidth;
-    int pen_color = style->pencolor.u.index;
-    int fill_color = style->fillcolor.u.index;
+    int thickness = obj->penwidth;
+    int pen_color = obj->pencolor.u.index;
+    int fill_color = obj->fillcolor.u.index;
     int depth = Depth;
     int pen_style = 0;          /* not used */
     int area_fill = filled ? 20 : -1;
@@ -461,7 +460,7 @@ static void figgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
     int backward_arrow = 0;
     int npoints = n + 1;
 
-    figgen_line_style(style, &line_style, &style_val);
+    figgen_line_style(obj, &line_style, &style_val);
 
     figgen_printf(job,
             "%d %d %d %d %d %d %d %d %d %.1f %d %d %d %d %d %d\n",
@@ -473,13 +472,13 @@ static void figgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
 
 static void figgen_polyline(GVJ_t * job, pointf * A, int n)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
 
     int object_code = 2;        /* always 2 for polyline */
     int sub_type = 1;           /* always 1 for polyline */
     int line_style;            /* solid, dotted, dashed */
-    int thickness = style->penwidth;
-    int pen_color = style->pencolor.u.index;
+    int thickness = obj->penwidth;
+    int pen_color = obj->pencolor.u.index;
     int fill_color = 0;
     int depth = Depth;
     int pen_style = 0;          /* not used */
@@ -492,7 +491,7 @@ static void figgen_polyline(GVJ_t * job, pointf * A, int n)
     int backward_arrow = 0;
     int npoints = n;
 
-    figgen_line_style(style, &line_style, &style_val);
+    figgen_line_style(obj, &line_style, &style_val);
 
     figgen_printf(job,
             "%d %d %d %d %d %d %d %d %d %.1f %d %d %d %d %d %d\n",
index 3678ee420d1aaf34be59289c064baf3b5fcb203c..a64e97db6e5916b0ccb1e5648cb141cb927825ea 100644 (file)
@@ -258,8 +258,8 @@ psgen_begin_edge(GVJ_t * job)
 static void
 ps_set_pen_style(GVJ_t *job)
 {
-    double penwidth = job->style->penwidth * job->zoom;
-    char *p, *line, **s = job->style->rawstyle;
+    double penwidth = job->obj->penwidth * job->zoom;
+    char *p, *line, **s = job->obj->rawstyle;
     FILE *out = job->output_file;
 
     fprintf(out,"%g setlinewidth\n", penwidth);
@@ -277,7 +277,7 @@ ps_set_pen_style(GVJ_t *job)
            p++;
        }
        if (strcmp(line, "invis") == 0)
-           job->style->penwidth = 0;
+           job->obj->penwidth = 0;
        fprintf(out, "%s\n", line);
     }
 }
@@ -322,10 +322,10 @@ static void psgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
     double adj, sz;
     char *str;
 
-    if (job->style->pencolor.u.HSVA[3] < .5)
+    if (job->obj->pencolor.u.HSVA[3] < .5)
        return;  /* skip transparent text */
 
-    ps_set_color(job, &(job->style->pencolor));
+    ps_set_color(job, &(job->obj->pencolor));
     if (para->fontname) {
        sz = para->fontsize;
         if (sz != last_fontsize
@@ -374,14 +374,14 @@ static void psgen_ellipse(GVJ_t * job, pointf * A, int filled)
 {
     /* A[] contains 2 points: the center and corner. */
 
-    if (filled && job->style->fillcolor.u.HSVA[3] > .5) {
-       ps_set_color(job, &(job->style->fillcolor));
+    if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
+       ps_set_color(job, &(job->obj->fillcolor));
        fprintf(job->output_file, "%g %g %g %g ellipse_path fill\n",
            A[0].x, A[0].y, fabs(A[1].x - A[0].x), fabs(A[1].y - A[0].y));
     }
-    if (job->style->pencolor.u.HSVA[3] > .5) {
+    if (job->obj->pencolor.u.HSVA[3] > .5) {
         ps_set_pen_style(job);
-        ps_set_color(job, &(job->style->pencolor));
+        ps_set_color(job, &(job->obj->pencolor));
         fprintf(job->output_file, "%g %g %g %g ellipse_path stroke\n",
            A[0].x, A[0].y, fabs(A[1].x - A[0].x), fabs(A[1].y - A[0].y));
     }
@@ -393,8 +393,8 @@ psgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
 {
     int j;
 
-    if (filled && job->style->fillcolor.u.HSVA[3] > .5) {
-       ps_set_color(job, &(job->style->fillcolor));
+    if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
+       ps_set_color(job, &(job->obj->fillcolor));
        fprintf(job->output_file, "newpath %g %g moveto\n", A[0].x, A[0].y);
        for (j = 1; j < n; j += 3)
            fprintf(job->output_file, "%g %g %g %g %g %g curveto\n",
@@ -402,9 +402,9 @@ psgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
                A[j + 2].y);
        fprintf(job->output_file, "closepath fill\n");
     }
-    if (job->style->pencolor.u.HSVA[3] > .5) {
+    if (job->obj->pencolor.u.HSVA[3] > .5) {
         ps_set_pen_style(job);
-        ps_set_color(job, &(job->style->pencolor));
+        ps_set_color(job, &(job->obj->pencolor));
         fprintf(job->output_file, "newpath %g %g moveto\n", A[0].x, A[0].y);
         for (j = 1; j < n; j += 3)
            fprintf(job->output_file, "%g %g %g %g %g %g curveto\n",
@@ -418,16 +418,16 @@ static void psgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
 {
     int j;
 
-    if (filled && job->style->fillcolor.u.HSVA[3] > .5) {
-       ps_set_color(job, &(job->style->fillcolor));
+    if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
+       ps_set_color(job, &(job->obj->fillcolor));
        fprintf(job->output_file, "newpath %g %g moveto\n", A[0].x, A[0].y);
        for (j = 1; j < n; j++)
            fprintf(job->output_file, "%g %g lineto\n", A[j].x, A[j].y);
        fprintf(job->output_file, "closepath fill\n");
     }
-    if (job->style->pencolor.u.HSVA[3] > .5) {
+    if (job->obj->pencolor.u.HSVA[3] > .5) {
         ps_set_pen_style(job);
-        ps_set_color(job, &(job->style->pencolor));
+        ps_set_color(job, &(job->obj->pencolor));
         fprintf(job->output_file, "newpath %g %g moveto\n", A[0].x, A[0].y);
         for (j = 1; j < n; j++)
            fprintf(job->output_file, "%g %g lineto\n", A[j].x, A[j].y);
@@ -439,9 +439,9 @@ static void psgen_polyline(GVJ_t * job, pointf * A, int n)
 {
     int j;
 
-    if (job->style->pencolor.u.HSVA[3] > .5) {
+    if (job->obj->pencolor.u.HSVA[3] > .5) {
         ps_set_pen_style(job);
-        ps_set_color(job, &(job->style->pencolor));
+        ps_set_color(job, &(job->obj->pencolor));
         fprintf(job->output_file, "newpath %g %g moveto\n", A[0].x, A[0].y);
         for (j = 1; j < n; j++)
            fprintf(job->output_file, "%g %g lineto\n", A[j].x, A[j].y);
index c1f433cdddd5c576498c8bce5438dd5479327ecb..fd746144606eeba05e2db4f0a9050cf384b3e786 100644 (file)
@@ -124,20 +124,20 @@ static void svggen_print_color(GVJ_t * job, gvcolor_t color)
 
 static void svggen_grstyle(GVJ_t * job, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
 
     svggen_fputs(job, " style=\"fill:");
     if (filled)
-       svggen_print_color(job, style->fillcolor);
+       svggen_print_color(job, obj->fillcolor);
     else
        svggen_fputs(job, "none");
     svggen_fputs(job, ";stroke:");
-    svggen_print_color(job, style->pencolor);
-    if (style->penwidth != PENWIDTH_NORMAL)
-       svggen_printf(job, ";stroke-width:%g", style->penwidth);
-    if (style->pen == PEN_DASHED) {
+    svggen_print_color(job, obj->pencolor);
+    if (obj->penwidth != PENWIDTH_NORMAL)
+       svggen_printf(job, ";stroke-width:%g", obj->penwidth);
+    if (obj->pen == PEN_DASHED) {
        svggen_printf(job, ";stroke-dasharray:%s", sdarray);
-    } else if (style->pen == PEN_DOTTED) {
+    } else if (obj->pen == PEN_DOTTED) {
        svggen_printf(job, ";stroke-dasharray:%s", sdotarray);
     }
     svggen_fputs(job, ";\"");
@@ -355,7 +355,7 @@ static void svggen_end_anchor(GVJ_t * job)
 
 static void svggen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
-    gvstyle_t *penstyle = job->style;
+    obj_state_t *obj = job->obj;
 
     svggen_fputs(job, "<text");
     switch (para->just) {
@@ -385,15 +385,14 @@ static void svggen_textpara(GVJ_t * job, pointf p, textpara_t * para)
         svggen_printf(job, "font:%s;", para->fontname);
     }
     svggen_printf(job, "font-size:%.2fpx;", para->fontsize);
-    switch (penstyle->pencolor.type) {
+    switch (obj->pencolor.type) {
     case COLOR_STRING:
-       if (strcasecmp(penstyle->pencolor.u.string, "black"))
-           svggen_printf(job, "fill:%s;", penstyle->pencolor.u.string);
+       if (strcasecmp(obj->pencolor.u.string, "black"))
+           svggen_printf(job, "fill:%s;", obj->pencolor.u.string);
        break;
     case RGBA_BYTE:
        svggen_printf(job, "fill:#%02x%02x%02x;",
-               penstyle->pencolor.u.rgba[0],
-               penstyle->pencolor.u.rgba[1], penstyle->pencolor.u.rgba[2]);
+               obj->pencolor.u.rgba[0], obj->pencolor.u.rgba[1], obj->pencolor.u.rgba[2]);
        break;
     default:
        assert(0);              /* internal error */
index 2cdb72edadae63c2da656652231004150f8ba23b..52c5550d5ca090fdb77ac898cd490bca1b676ca9 100644 (file)
@@ -323,15 +323,15 @@ static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
        /* draw para in place of text */
        gdImageLine(im, ROUND(mp.x), ROUND(mp.y),
                    ROUND(ep.x), ROUND(ep.y),
-                   job->style->pencolor.u.index);
+                   job->obj->pencolor.u.index);
     } else {
 #if defined(HAVE_LIBFREETYPE) && defined(HAVE_GD_FREETYPE)
-       err = gdImageStringFTEx(im, brect, job->style->pencolor.u.index,
+       err = gdImageStringFTEx(im, brect, job->obj->pencolor.u.index,
                                para->fontname, para->fontsize, job->rotation ? (PI / 2) : 0,
                                ROUND(mp.x), ROUND(mp.y), (char *)(para->str), &strex);
 #if 0
        gdImagePolygon(im, (gdPointPtr) brect, 4,
-                      job->style->pencolor.u.index);
+                      job->obj->pencolor.u.index);
 #endif
 #if 0
        fprintf(stderr,
@@ -349,27 +349,27 @@ static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
                gdImageString(im, gdFontTiny,
                              ROUND(mp.x), ROUND(mp.y - 9.),
                              (unsigned char *)para->str,
-                             job->style->pencolor.u.index);
+                             job->obj->pencolor.u.index);
            } else if (para->fontsize <= 9.5) {
                gdImageString(im, gdFontSmall,
                              ROUND(mp.x), ROUND(mp.y - 12.),
                              (unsigned char *)para->str,
-                             job->style->pencolor.u.index);
+                             job->obj->pencolor.u.index);
            } else if (para->fontsize <= 10.5) {
                gdImageString(im, gdFontMediumBold,
                              ROUND(mp.x), ROUND(mp.y - 13.),
                              (unsigned char *)para->str,
-                             job->style->pencolor.u.index);
+                             job->obj->pencolor.u.index);
            } else if (para->fontsize <= 11.5) {
                gdImageString(im, gdFontLarge,
                              ROUND(mp.x), ROUND(mp.y - 14.),
                              (unsigned char *)para->str,
-                             job->style->pencolor.u.index);
+                             job->obj->pencolor.u.index);
            } else {
                gdImageString(im, gdFontGiant,
                              ROUND(mp.x), ROUND(mp.y - 15.),
                              (unsigned char *)para->str,
-                             job->style->pencolor.u.index);
+                             job->obj->pencolor.u.index);
            }
 #if defined(HAVE_LIBFREETYPE) && defined(HAVE_GD_FREETYPE)
        }
@@ -379,28 +379,28 @@ static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 
 static int gdgen_set_penstyle(GVJ_t * job, gdImagePtr im, gdImagePtr brush)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     int i, pen, width, dashstyle[40];
 
-    if (style->pen == PEN_DASHED) {
+    if (obj->pen == PEN_DASHED) {
        for (i = 0; i < 10; i++)
-           dashstyle[i] = style->pencolor.u.index;
+           dashstyle[i] = obj->pencolor.u.index;
        for (; i < 20; i++)
            dashstyle[i] = transparent;
        gdImageSetStyle(im, dashstyle, 20);
        pen = gdStyled;
-    } else if (style->pen == PEN_DOTTED) {
+    } else if (obj->pen == PEN_DOTTED) {
        for (i = 0; i < 2; i++)
-           dashstyle[i] = style->pencolor.u.index;
+           dashstyle[i] = obj->pencolor.u.index;
        for (; i < 14; i++)
            dashstyle[i] = transparent;
        gdImageSetStyle(im, dashstyle, 12);
        pen = gdStyled;
     } else {
-       pen = style->pencolor.u.index;
+       pen = obj->pencolor.u.index;
     }
 
-    width = style->penwidth * job->scale.x;
+    width = obj->penwidth * job->scale.x;
     if (width < PENWIDTH_NORMAL)
        width = PENWIDTH_NORMAL;  /* gd can't do thin lines */
     gdImageSetThickness(im, width);
@@ -409,7 +409,7 @@ static int gdgen_set_penstyle(GVJ_t * job, gdImagePtr im, gdImagePtr brush)
        brush = gdImageCreate(width, width);
        gdImagePaletteCopy(brush, im);
        gdImageFilledRectangle(brush, 0, 0, width - 1, width - 1,
-                              style->pencolor.u.index);
+                              obj->pencolor.u.index);
        gdImageSetBrush(im, brush);
        if (pen == gdStyled)
            pen = gdStyledBrushed;
@@ -424,7 +424,7 @@ static void
 gdgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
             int arrow_at_end, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     gdImagePtr im = (gdImagePtr) job->surface;
     pointf p0, p1, V[4];
     int i, j, step, pen;
@@ -450,7 +450,7 @@ gdgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
            PF2P(p1, F[2]);
            gdImageLine(im, F[1].x, F[1].y, F[2].x, F[2].y, pen);
            if (filled)
-               gdImageFilledPolygon(im, F, 4, style->fillcolor.u.index);
+               gdImageFilledPolygon(im, F, 4, obj->fillcolor.u.index);
            p0 = p1;
        }
     }
@@ -460,7 +460,7 @@ gdgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
 
 static void gdgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     gdImagePtr im = (gdImagePtr) job->surface;
     gdImagePtr brush = NULL;
     int i;
@@ -478,7 +478,7 @@ static void gdgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
        points[i].y = ROUND(A[i].y);
     }
     if (filled)
-       gdImageFilledPolygon(im, points, n, style->fillcolor.u.index);
+       gdImageFilledPolygon(im, points, n, obj->fillcolor.u.index);
 
     gdImagePolygon(im, points, n, pen);
     free(points);
@@ -488,7 +488,7 @@ static void gdgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
 
 static void gdgen_ellipse(GVJ_t * job, pointf * A, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     gdImagePtr im = (gdImagePtr) job->surface;
     double dx, dy;
     int pen;
@@ -505,7 +505,7 @@ static void gdgen_ellipse(GVJ_t * job, pointf * A, int filled)
     if (filled)
        gdImageFilledEllipse(im, ROUND(A[0].x), ROUND(A[0].y),
                             ROUND(dx), ROUND(dy),
-                            style->fillcolor.u.index);
+                            obj->fillcolor.u.index);
     gdImageArc(im, ROUND(A[0].x), ROUND(A[0].y), ROUND(dx), ROUND(dy),
               0, 360, pen);
     if (brush)
index 46d87327c464340b19b975fdbc78205f7174d52b..cc9f050b2c7cbb0e76fa7bde3c032992272f3139 100644 (file)
@@ -159,19 +159,19 @@ static int color_index(gdImagePtr im, gvcolor_t color)
 
 static int set_penstyle(GVJ_t * job, gdImagePtr im, gdImagePtr brush)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     int i, pen, pencolor, transparent, width, dashstyle[40];
 
-    pen = pencolor = color_index(im, style->pencolor);
+    pen = pencolor = color_index(im, obj->pencolor);
     transparent = gdImageGetTransparent(im);
-    if (style->pen == PEN_DASHED) {
+    if (obj->pen == PEN_DASHED) {
         for (i = 0; i < 20; i++)
             dashstyle[i] = pencolor;
         for (; i < 40; i++)
             dashstyle[i] = transparent;
         gdImageSetStyle(im, dashstyle, 20);
         pen = gdStyled;
-    } else if (style->pen == PEN_DOTTED) {
+    } else if (obj->pen == PEN_DOTTED) {
         for (i = 0; i < 2; i++)
             dashstyle[i] = pencolor;
         for (; i < 24; i++)
@@ -179,7 +179,7 @@ static int set_penstyle(GVJ_t * job, gdImagePtr im, gdImagePtr brush)
         gdImageSetStyle(im, dashstyle, 24);
         pen = gdStyled;
     }
-    width = style->penwidth * job->scale.x;
+    width = obj->penwidth * job->scale.x;
     if (width < PENWIDTH_NORMAL)
         width = PENWIDTH_NORMAL;  /* gd can't do thin lines */
     gdImageSetThickness(im, width);
@@ -356,7 +356,7 @@ static void vrml_textpara(GVJ_t *job, pointf p, textpara_t * para)
     mp = vrml_node_point(job, obj->u.n, p);
 
     err = gdImageStringFT(im, brect,
-           color_index(im, job->style->pencolor),
+           color_index(im, obj->pencolor),
            para->fontname, para->fontsize, job->rotation ? PI/2 : 0,
            ROUND(mp.x), ROUND(mp.y), (char*)para->str);
     if (err) {
@@ -364,7 +364,7 @@ static void vrml_textpara(GVJ_t *job, pointf p, textpara_t * para)
        gdImageString(im,
                gdFontSmall, ROUND(mp.x), ROUND(mp.y),
                (unsigned char *) para->str,
-               color_index(im, job->style->pencolor));
+               color_index(im, obj->pencolor));
     }
 }
 
@@ -426,7 +426,7 @@ static void
 doSegment (GVJ_t *job, pointf* A, point p0, double z0, point p1, double z1)
 {
     FILE *out = job->output_file;
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     double d1, d0;
     double delx, dely, delz;
 
@@ -445,14 +445,14 @@ doSegment (GVJ_t *job, pointf* A, point p0, double z0, point p1, double z1)
     fprintf(out, "    Shape {\n");
     fprintf(out, "      geometry Cylinder {\n"); 
     fprintf(out, "        bottom FALSE top FALSE\n"); 
-    fprintf(out, "        height %.3f radius %.3f }\n", CylHt, style->penwidth);
+    fprintf(out, "        height %.3f radius %.3f }\n", CylHt, obj->penwidth);
     fprintf(out, "      appearance Appearance {\n");
     fprintf(out, "        material Material {\n");
     fprintf(out, "          ambientIntensity 0.33\n");
     fprintf(out, "          diffuseColor %.3f %.3f %.3f\n",
-           style->pencolor.u.rgba[0] / 255.,
-           style->pencolor.u.rgba[1] / 255.,
-           style->pencolor.u.rgba[2] / 255.);
+           obj->pencolor.u.rgba[0] / 255.,
+           obj->pencolor.u.rgba[1] / 255.,
+           obj->pencolor.u.rgba[2] / 255.);
     fprintf(out, "        }\n");
     fprintf(out, "      }\n");
     fprintf(out, "    }\n");
@@ -462,7 +462,6 @@ static void
 vrml_bezier(GVJ_t *job, pointf * A, int n, int arrow_at_start, int arrow_at_end, int filled)
 {
     FILE *out = job->output_file;
-    gvstyle_t *style = job->style;
     obj_state_t *obj = job->obj;
     edge_t *e = obj->u.e;
     double fstz = obj->tail_z, sndz = obj->head_z;
@@ -491,17 +490,17 @@ vrml_bezier(GVJ_t *job, pointf * A, int n, int arrow_at_start, int arrow_at_end,
     }
     fprintf(out, " ]\n");
     fprintf(out, "  crossSection [ %.3f %.3f, %.3f %.3f, %.3f %.3f, %.3f %.3f ]\n",
-           (style->penwidth), (style->penwidth), -(style->penwidth),
-           (style->penwidth), -(style->penwidth), -(style->penwidth),
-           (style->penwidth), -(style->penwidth));
+           (obj->penwidth), (obj->penwidth), -(obj->penwidth),
+           (obj->penwidth), -(obj->penwidth), -(obj->penwidth),
+           (obj->penwidth), -(obj->penwidth));
     fprintf(out, "}\n");
     fprintf(out, " appearance DEF E%d Appearance {\n", e->id);
     fprintf(out, "   material Material {\n");
     fprintf(out, "   ambientIntensity 0.33\n");
     fprintf(out, "   diffuseColor %.3f %.3f %.3f\n",
-           style->pencolor.u.rgba[0] / 255.,
-           style->pencolor.u.rgba[1] / 255.,
-           style->pencolor.u.rgba[2] / 255.);
+           obj->pencolor.u.rgba[0] / 255.,
+           obj->pencolor.u.rgba[1] / 255.,
+           obj->pencolor.u.rgba[2] / 255.);
     fprintf(out, "   }\n");
     fprintf(out, " }\n");
     fprintf(out, "}\n");
@@ -513,7 +512,6 @@ vrml_bezier(GVJ_t *job, pointf * A, int n, int arrow_at_start, int arrow_at_end,
 static void doArrowhead (GVJ_t *job, pointf * A)
 {
     FILE *out = job->output_file;
-    gvstyle_t *style = job->style;
     obj_state_t *obj = job->obj;
     edge_t *e = obj->u.e;
     double rad, ht, y;
@@ -547,9 +545,9 @@ static void doArrowhead (GVJ_t *job, pointf * A)
     fprintf(out, "        material Material {\n");
     fprintf(out, "          ambientIntensity 0.33\n");
     fprintf(out, "          diffuseColor %.3f %.3f %.3f\n",
-           style->pencolor.u.rgba[0] / 255.,
-           style->pencolor.u.rgba[1] / 255.,
-           style->pencolor.u.rgba[2] / 255.);
+           obj->pencolor.u.rgba[0] / 255.,
+           obj->pencolor.u.rgba[1] / 255.,
+           obj->pencolor.u.rgba[2] / 255.);
     fprintf(out, "        }\n");
     fprintf(out, "      }\n");
     fprintf(out, "    }\n");
@@ -560,7 +558,6 @@ static void doArrowhead (GVJ_t *job, pointf * A)
 static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
 {
     FILE *out = job->output_file;
-    gvstyle_t *style = job->style;
     obj_state_t *obj = job->obj;
     node_t *n;
     edge_t *e;
@@ -574,9 +571,9 @@ static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
     switch (obj->type) {
     case ROOTGRAPH_OBJTYPE:
        fprintf(out, " Background { skyColor %.3f %.3f %.3f }\n",
-           style->fillcolor.u.rgba[0] / 255.,
-           style->fillcolor.u.rgba[1] / 255.,
-           style->fillcolor.u.rgba[2] / 255.);
+           obj->fillcolor.u.rgba[0] / 255.,
+           obj->fillcolor.u.rgba[1] / 255.,
+           obj->fillcolor.u.rgba[2] / 255.);
        Saw_skycolor = TRUE;
        break;
     case CLUSTER_OBJTYPE:
@@ -591,7 +588,7 @@ static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
            points[i].y = ROUND(mp.y);
        }
        if (filled)
-           gdImageFilledPolygon(im, points, np, color_index(im, job->style->fillcolor));
+           gdImageFilledPolygon(im, points, np, color_index(im, obj->fillcolor));
        gdImagePolygon(im, points, np, pen);
        free(points);
        if (brush)
@@ -663,7 +660,7 @@ static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
        fprintf(out, "      children [\n");
        fprintf(out, "        Shape {\n");
        fprintf(out, "          geometry Cone {bottomRadius %.3f height %.3f }\n",
-               style->penwidth * 2.5, style->penwidth * 10.0);
+               obj->penwidth * 2.5, obj->penwidth * 10.0);
        fprintf(out, "          appearance USE E%d\n", e->id);
        fprintf(out, "        }\n");
        fprintf(out, "      ]\n");
@@ -681,7 +678,7 @@ static void
 doSphere (GVJ_t *job, node_t *n, pointf p, double z, double rx, double ry)
 {
     FILE *out = job->output_file;
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
 
 //    if (!(strcmp(cstk[SP].fillcolor, "transparent"))) {
 //     return;
@@ -699,9 +696,9 @@ doSphere (GVJ_t *job, node_t *n, pointf p, double z, double rx, double ry)
     fprintf(out, "            material Material {\n");
     fprintf(out, "              ambientIntensity 0.33\n");
     fprintf(out, "              diffuseColor %.3f %.3f %.3f\n", 
-           style->pencolor.u.rgba[0] / 255.,
-           style->pencolor.u.rgba[1] / 255.,
-           style->pencolor.u.rgba[2] / 255.);
+           obj->pencolor.u.rgba[0] / 255.,
+           obj->pencolor.u.rgba[1] / 255.,
+           obj->pencolor.u.rgba[2] / 255.);
     fprintf(out, "            }\n");
     fprintf(out, "          }\n");
     fprintf(out, "        }\n");
@@ -714,7 +711,6 @@ doSphere (GVJ_t *job, node_t *n, pointf p, double z, double rx, double ry)
 static void vrml_ellipse(GVJ_t * job, pointf * A, int filled)
 {
     FILE *out = job->output_file;
-    gvstyle_t *style = job->style;
     obj_state_t *obj = job->obj;
     node_t *n;
     edge_t *e;
@@ -752,7 +748,7 @@ static void vrml_ellipse(GVJ_t * job, pointf * A, int filled)
        PF2P(npf, np);
 
        if (filled)
-           gdImageFilledEllipse(im, np.x, np.y, dx, dy, color_index(im, style->fillcolor));
+           gdImageFilledEllipse(im, np.x, np.y, dx, dy, color_index(im, obj->fillcolor));
        gdImageArc(im, np.x, np.y, dx, dy, 0, 360, pen);
 
        if (brush)
index 60d891f3bbd2b4111f88f60e3224feda2b15b9a1..461f28e0cf209b112801b88981759c10bea877d0 100644 (file)
@@ -243,14 +243,14 @@ static void cairogen_end_page(GVJ_t * job)
 
 static void cairogen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     cairo_t *cr = (cairo_t *) job->surface;
     pointf offset;
     PangoLayout *layout = (PangoLayout*)(para->layout);
     PangoLayoutIter* iter;
 
     cairo_set_dash (cr, dashed, 0, 0.0);  /* clear any dashing */
-    cairogen_set_color(cr, &(style->pencolor));
+    cairogen_set_color(cr, &(obj->pencolor));
 
     switch (para->just) {
     case 'r':
@@ -274,22 +274,22 @@ static void cairogen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 
 static void cairogen_set_penstyle(GVJ_t *job, cairo_t *cr)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
 
-    if (style->pen == PEN_DASHED) {
+    if (obj->pen == PEN_DASHED) {
        cairo_set_dash (cr, dashed, dashed_len, 0.0);
-    } else if (style->pen == PEN_DOTTED) {
+    } else if (obj->pen == PEN_DOTTED) {
        cairo_set_dash (cr, dotted, dotted_len, 0.0);
     } else {
        cairo_set_dash (cr, dashed, 0, 0.0);
     }
-    cairo_set_line_width (cr, style->penwidth * job->scale.x);
+    cairo_set_line_width (cr, obj->penwidth * job->scale.x);
 
 }
 
 static void cairogen_ellipse(GVJ_t * job, pointf * A, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     cairo_t *cr = (cairo_t *) job->surface;
     cairo_matrix_t matrix;
     double rx, ry;
@@ -309,17 +309,17 @@ static void cairogen_ellipse(GVJ_t * job, pointf * A, int filled)
     cairo_set_matrix(cr, &matrix);
 
     if (filled) {
-       cairogen_set_color(cr, &(style->fillcolor));
+       cairogen_set_color(cr, &(obj->fillcolor));
        cairo_fill_preserve(cr);
     }
-    cairogen_set_color(cr, &(style->pencolor));
+    cairogen_set_color(cr, &(obj->pencolor));
     cairo_stroke(cr);
 }
 
 static void
 cairogen_polygon(GVJ_t * job, pointf * A, int n, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     cairo_t *cr = (cairo_t *) job->surface;
     int i;
 
@@ -330,10 +330,10 @@ cairogen_polygon(GVJ_t * job, pointf * A, int n, int filled)
        cairo_line_to(cr, A[i].x, -A[i].y);
     cairo_close_path(cr);
     if (filled) {
-       cairogen_set_color(cr, &(style->fillcolor));
+       cairogen_set_color(cr, &(obj->fillcolor));
        cairo_fill_preserve(cr);
     }
-    cairogen_set_color(cr, &(style->pencolor));
+    cairogen_set_color(cr, &(obj->pencolor));
     cairo_stroke(cr);
 }
 
@@ -341,7 +341,7 @@ static void
 cairogen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
                int arrow_at_end, int filled)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     cairo_t *cr = (cairo_t *) job->surface;
     int i;
 
@@ -351,24 +351,24 @@ cairogen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
     for (i = 1; i < n; i += 3)
        cairo_curve_to(cr, A[i].x, -A[i].y, A[i + 1].x, -A[i + 1].y,
                       A[i + 2].x, -A[i + 2].y);
-    cairogen_set_color(cr, &(style->pencolor));
+    cairogen_set_color(cr, &(obj->pencolor));
     cairo_stroke(cr);
 }
 
 static void
 cairogen_polyline(GVJ_t * job, pointf * A, int n)
 {
-    gvstyle_t *style = job->style;
+    obj_state_t *obj = job->obj;
     cairo_t *cr = (cairo_t *) job->surface;
     int i;
 
     cairogen_set_penstyle(job, cr);
 
-    cairo_set_line_width (cr, style->penwidth * job->scale.x);
+    cairo_set_line_width (cr, obj->penwidth * job->scale.x);
     cairo_move_to(cr, A[0].x, -A[0].y);
     for (i = 1; i < n; i++)
        cairo_line_to(cr, A[i].x, -A[i].y);
-    cairogen_set_color(cr, &(style->pencolor));
+    cairogen_set_color(cr, &(obj->pencolor));
     cairo_stroke(cr);
 }