]> granicus.if.org Git - graphviz/commitdiff
move current style into gvrender_job_t
authorellson <devnull@localhost>
Mon, 17 Jan 2005 17:25:35 +0000 (17:25 +0000)
committerellson <devnull@localhost>
Mon, 17 Jan 2005 17:25:35 +0000 (17:25 +0000)
lib/gvc/gvcint.h
lib/gvc/gvrender.c

index a7e2bd24c5c8f609be2deab74c78cdb53e3d0284..e64f9b1d9f006f93251ba1ef9f68e779bc51ba8f 100644 (file)
 extern "C" {
 #endif
 
+    typedef enum { PEN_NONE, PEN_DASHED, PEN_DOTTED, PEN_SOLID } pen_type;
+    typedef enum { FILL_NONE, FILL_SOLID } fill_type;
+    typedef enum { FONT_REGULAR, FONT_BOLD, FONT_ITALIC } font_type;
+#define PENWIDTH_NORMAL 1
+#define PENWIDTH_BOLD 2
+
+    typedef struct {
+       char *fontfam, fontopt;
+       color_t pencolor, fillcolor;
+       pen_type pen;
+       fill_type fill;
+       int penwidth;
+       double fontsz;
+    } gvstyle_t;
+
 #define EMIT_SORTED (1<<0)
 #define EMIT_COLORS (1<<1)
 #define EMIT_CLUSTERS_LAST (1<<2)
@@ -67,6 +82,8 @@ extern "C" {
        void *surface;          /* gd or cairo surface */
        boolean external_surface; /* surface belongs to caller */
 
+       gvstyle_t *style;       /* active style from gvc->styles[] */
+
        GVC_t *gvc;             /* parent gvc */
         graph_t *g;            /* parent graph */
         int flags;             /* emit_graph flags */
@@ -111,21 +128,6 @@ extern "C" {
        gvplugin_type_t *typeptr;
     };
 
-    typedef enum { PEN_NONE, PEN_DASHED, PEN_DOTTED, PEN_SOLID } pen_type;
-    typedef enum { FILL_NONE, FILL_SOLID } fill_type;
-    typedef enum { FONT_REGULAR, FONT_BOLD, FONT_ITALIC } font_type;
-#define PENWIDTH_NORMAL 1
-#define PENWIDTH_BOLD 2
-
-    typedef struct {
-       char *fontfam, fontopt;
-       color_t pencolor, fillcolor;
-       pen_type pen;
-       fill_type fill;
-       int penwidth;
-       double fontsz;
-    } gvstyle_t;
-
 #define MAXNEST 4
 
     struct GVC_s {
@@ -160,7 +162,6 @@ extern "C" {
 
        gvstyle_t styles[MAXNEST];      /* style stack */
        int SP;
-       gvstyle_t *style;
 
        /* render defaults set from graph */
        color_t bgcolor;        /* background color */
index 06fbc317cc98b38a2a08434818ce9a2fefda5eee..71cb2c4610a73f78fb4588472de0162868236ad5 100644 (file)
@@ -263,15 +263,15 @@ void gvrender_begin_graph(GVC_t * gvc, graph_t * g, box bb, point pb)
 
        /* init stack */
        gvc->SP = 0;
-       gvc->style = &(gvc->styles[0]);
+       job->style = &(gvc->styles[0]);
        gvrender_set_pencolor(gvc, DEFAULT_COLOR);
        gvrender_set_fillcolor(gvc, DEFAULT_FILL);
-       gvc->style->fontfam = DEFAULT_FONTNAME;
-       gvc->style->fontsz = DEFAULT_FONTSIZE;
-       gvc->style->fontopt = FONT_REGULAR;
-       gvc->style->pen = PEN_SOLID;
-       gvc->style->fill = PEN_NONE;
-       gvc->style->penwidth = PENWIDTH_NORMAL;
+       job->style->fontfam = DEFAULT_FONTNAME;
+       job->style->fontsz = DEFAULT_FONTSIZE;
+       job->style->fontopt = FONT_REGULAR;
+       job->style->pen = PEN_SOLID;
+       job->style->fill = PEN_NONE;
+       job->style->penwidth = PENWIDTH_NORMAL;
     }
 #ifndef DISABLE_CODEGENS
     else {
@@ -562,7 +562,7 @@ void gvrender_begin_context(GVC_t * gvc)
        (gvc->SP)++;
        assert((gvc->SP) < MAXNEST);
        (gvc->styles)[gvc->SP] = (gvc->styles)[(gvc->SP) - 1];
-       gvc->style = &((gvc->styles)[gvc->SP]);
+       job->style = &((gvc->styles)[gvc->SP]);
     }
 #ifndef DISABLE_CODEGENS
     else {
@@ -582,7 +582,7 @@ void gvrender_end_context(GVC_t * gvc)
     if (gvre) {
        gvc->SP--;
        assert(gvc->SP >= 0);
-       gvc->style = &(gvc->styles[gvc->SP]);
+       job->style = &(gvc->styles[gvc->SP]);
     }
 #ifndef DISABLE_CODEGENS
     else {
@@ -635,8 +635,8 @@ void gvrender_set_font(GVC_t * gvc, char *fontname, double fontsize)
     gvrender_engine_t *gvre = job->render_engine;
 
     if (gvre) {
-       gvc->style->fontfam = fontname;
-       gvc->style->fontsz = fontsize;
+       job->style->fontfam = fontname;
+       job->style->fontsz = fontsize;
     }
 #ifndef DISABLE_CODEGENS
     else {
@@ -655,7 +655,7 @@ void gvrender_textline(GVC_t * gvc, pointf p, textline_t * line)
 
     if (line->str && line->str[0]) {
        if (gvre && gvre->textline) {
-           if (gvc->style->pen != PEN_NONE) {
+           if (job->style->pen != PEN_NONE) {
                gvre->textline(gvc, gvrender_ptf(gvc, p), line);
            }
        }
@@ -676,7 +676,7 @@ void gvrender_set_pencolor(GVC_t * gvc, char *name)
 {
     gvrender_job_t *job = gvc->job;
     gvrender_engine_t *gvre = job->render_engine;
-    color_t *color = &(gvc->style->pencolor);
+    color_t *color = &(job->style->pencolor);
 
     if (gvre) {
        gvrender_resolve_color(job->render_features, name, color);
@@ -697,7 +697,7 @@ void gvrender_set_fillcolor(GVC_t * gvc, char *name)
 {
     gvrender_job_t *job = gvc->job;
     gvrender_engine_t *gvre = job->render_engine;
-    color_t *color = &(gvc->style->fillcolor);
+    color_t *color = &(job->style->fillcolor);
 
     if (gvre) {
        gvrender_resolve_color(job->render_features, name, color);
@@ -719,7 +719,7 @@ void gvrender_set_style(GVC_t * gvc, char **s)
     gvrender_job_t *job = gvc->job;
     gvrender_engine_t *gvre = job->render_engine;
     char *line, *p;
-    gvstyle_t *style = gvc->style;
+    gvstyle_t *style = job->style;
 
     if (gvre) {
        while ((p = line = *s++)) {
@@ -765,7 +765,7 @@ void gvrender_ellipse(GVC_t * gvc, point p, int rx, int ry, int filled)
     gvrender_engine_t *gvre = job->render_engine;
 
     if (gvre && gvre->ellipse) {
-       if (gvc->style->pen != PEN_NONE) {
+       if (job->style->pen != PEN_NONE) {
 /* temporary hack until client API is FP */
            pointf AF[2];
            int i;
@@ -799,7 +799,7 @@ void gvrender_polygon(GVC_t * gvc, point * A, int n, int filled)
     gvrender_engine_t *gvre = job->render_engine;
 
     if (gvre && gvre->polygon) {
-       if (gvc->style->pen != PEN_NONE) {
+       if (job->style->pen != PEN_NONE) {
 /* temporary hack until client API is FP */
            static pointf *AF;
            static int sizeAF;
@@ -830,7 +830,7 @@ void gvrender_beziercurve(GVC_t * gvc, pointf * AF, int n,
     gvrender_engine_t *gvre = job->render_engine;
 
     if (gvre && gvre->beziercurve) {
-       if (gvc->style->pen != PEN_NONE) {
+       if (job->style->pen != PEN_NONE) {
            static pointf *AF2;
            static int sizeAF2;
            int i;
@@ -868,7 +868,7 @@ void gvrender_polyline(GVC_t * gvc, point * A, int n)
     gvrender_engine_t *gvre = job->render_engine;
 
     if (gvre && gvre->polyline) {
-       if (gvc->style->pen != PEN_NONE) {
+       if (job->style->pen != PEN_NONE) {
            static pointf *AF;
            static int sizeAF;
            int i;