]> granicus.if.org Git - graphviz/commitdiff
Call gvdevice_... plugin entry points from emit.c, rather than from another plugin.
authorellson <devnull@localhost>
Thu, 30 Aug 2007 20:59:31 +0000 (20:59 +0000)
committerellson <devnull@localhost>
Thu, 30 Aug 2007 20:59:31 +0000 (20:59 +0000)
Rename job-surface to job->context.
Add job->imagedata.

16 files changed:
lib/common/emit.c
lib/gvc/gvcjob.h
lib/gvc/gvcproc.h
lib/gvc/gvdevice.c
lib/gvc/gvplugin_device.h
plugin/devil/gvdevice_devil.c
plugin/gd/gvdevice_gd.c
plugin/gd/gvloadimage_gd.c
plugin/gd/gvrender_gd.c
plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c
plugin/gtk/callbacks.c
plugin/gtk/gvdevice_gtk.c
plugin/ming/gvrender_ming.c
plugin/pango/gvloadimage_pango.c
plugin/pango/gvrender_pango.c
plugin/xlib/gvdevice_xlib.c

index 1a9c043adbb8a29acc0d3578013e747c8d7e15fa..863d9e8acd00936f11a7f90aaf7fdd8e11b0ca21 100644 (file)
@@ -2214,6 +2214,7 @@ void emit_graph(GVJ_t * job, graph_t * g)
            setColorScheme (agget (g, "colorscheme"));
            setup_page(job, g);
            gvrender_begin_page(job);
+           gvdevice_prepare(job);
            gvrender_set_pencolor(job, DEFAULT_COLOR);
            gvrender_set_fillcolor(job, DEFAULT_FILL);
            gvrender_set_font(job, gvc->defaultfontname, gvc->defaultfontsize);
@@ -2240,6 +2241,7 @@ void emit_graph(GVJ_t * job, graph_t * g)
                gvrender_end_anchor(job);
 //         if (boxf_overlap(job->clip, job->pageBox))
                emit_view(job,g,flags);
+           gvdevice_format(job);
            gvrender_end_page(job);
        } 
 
@@ -2831,7 +2833,7 @@ int gvRenderJobs (GVC_t * gvc, graph_t * g)
            emit_graph(job, g); /* FIXME? - this should be a special case of finalize() */
 
            /* Flush is necessary because we may be writing to a pipe. */
-           if (job->output_file && ! job->external_surface && job->output_lang != TK)
+           if (job->output_file && ! job->external_context && job->output_lang != TK)
                fflush(job->output_file);
        }
 
index bf501086e8096cad90c2721eeeb04c2754466366..34a9495ecc5e0728d46b8200ef8a770c00940ee1 100644 (file)
@@ -252,8 +252,9 @@ typedef enum {COMPRESSION_NONE, COMPRESSION_ZLIB} compression_t;
        void *display;
        int screen;
 
-       void *surface;          /* gd or cairo surface */
-       boolean external_surface;       /* surface belongs to caller */
+       void *context;          /* gd or cairo surface */
+       boolean external_context;       /* context belongs to caller */
+       unsigned char *imagedata; /* location of imagedata */
 
         int flags;             /* emit_graph flags */
 
index 3cd1bf28c9db0ad5dc0b5adf9c023fb1df0f6db6..e8fbf69105053ff40a3bf3df5fc5c7f83b6a4326 100644 (file)
@@ -70,6 +70,8 @@ extern "C" {
 /* device */
 
     extern void gvdevice_initialize(GVJ_t * job);
+    extern void gvdevice_prepare(GVJ_t * job);
+    extern void gvdevice_format(GVJ_t * job);
     extern void gvdevice_finalize(GVJ_t * job);
 
 /* render */
index b693390e38c9eb261e2c60ccb094918620838049..8dd11e9fe8f84ac261a1ebaab799dd7c681bf93b 100644 (file)
@@ -81,11 +81,24 @@ void gvdevice_initialize(GVJ_t * firstjob)
 {
     gvdevice_engine_t *gvde = firstjob->device.engine;
 
-    if (gvde) {
-       if (gvde->initialize) {
-           gvde->initialize(firstjob);
-       }
-    }
+    if (gvde && gvde->initialize)
+       gvde->initialize(firstjob);
+}
+
+void gvdevice_prepare(GVJ_t * job)
+{
+    gvdevice_engine_t *gvde = job->device.engine;
+
+    if (gvde && gvde->prepare)
+       gvde->prepare(job);
+}
+
+void gvdevice_format(GVJ_t * job)
+{
+    gvdevice_engine_t *gvde = job->device.engine;
+
+    if (gvde && gvde->format)
+       gvde->format(job);
 }
 
 void gvdevice_finalize(GVJ_t * firstjob)
@@ -111,7 +124,7 @@ void gvdevice_finalize(GVJ_t * firstjob)
     for (job = firstjob; job; job = job->next_active) {
        if (job->output_filename
          && job->output_file != stdout 
-         && ! job->external_surface) {
+         && ! job->external_context) {
            if (job->output_file) {
                fclose(job->output_file);
                job->output_file = NULL;
index d626e5e340bc3b9df34e06af07a778a2be006016..600bd490df89a0925cf8de7d2394673786569a4d 100644 (file)
@@ -27,7 +27,8 @@ extern "C" {
 
     struct gvdevice_engine_s {
        void (*initialize) (GVJ_t * firstjob);
-       void (*format) (GVJ_t * firstjob, unsigned int width, unsigned int height, unsigned char *data);
+       void (*prepare) (GVJ_t * firstjob);
+       void (*format) (GVJ_t * firstjob);
        void (*finalize) (GVJ_t * firstjob);
     };
 
index 21110b806ab5f51a1e830eda3011e49b03abc1c3..545926449f51d9aa65aec24ea87d994dccc0a09b 100644 (file)
@@ -48,7 +48,7 @@ Y_inv ( unsigned int width, unsigned int height, unsigned char *data)
         }
 }
 
-static void devil_format(GVJ_t * job, unsigned int width, unsigned int height, unsigned char *data)
+static void devil_format(GVJ_t * job)
 {
     ILuint     ImgId;
     ILenum     Error;
@@ -79,14 +79,14 @@ static void devil_format(GVJ_t * job, unsigned int width, unsigned int height, u
     // Bind this image name.
     ilBindImage(ImgId);
 
-    Y_inv ( width, height, data );
+    Y_inv ( job->width, job->height, job->imagedata );
     
-    rc = ilTexImage( width, height,
+    rc = ilTexImage( job->width, job->height,
                1,              // Depth
                4,              // Bpp
                IL_BGRA,        // Format
                IL_UNSIGNED_BYTE,// Type
-               data);
+               job->imagedata);
     
 #if 1
     ilSaveF(job->device.id, job->output_file);
@@ -107,6 +107,7 @@ static void devil_format(GVJ_t * job, unsigned int width, unsigned int height, u
 }
 
 static gvdevice_engine_t devil_engine = {
+    NULL,
     NULL,
     devil_format,
     NULL,
index 8d876192dcd927383971150a039e8492035ad916..98aacbb62a7c965470bc6a5429514b62e031b281 100644 (file)
@@ -38,10 +38,13 @@ typedef enum {
        FORMAT_XBM,
 } format_type;
 
-static void gd_format(GVJ_t * job, unsigned int width, unsigned int height, unsigned char *data)
+static void gd_format(GVJ_t * job)
 {
     gdImagePtr im;
-    unsigned int x, y, *intdata, color, alpha;
+    unsigned int x, y, color, alpha;
+    unsigned int *data = (unsigned int*)(job->imagedata);
+    unsigned int width = job->width;
+    unsigned int height = job->height;
 
 #ifdef HAVE_SETMODE
 #ifdef O_BINARY
@@ -53,11 +56,10 @@ static void gd_format(GVJ_t * job, unsigned int width, unsigned int height, unsi
 #endif
 #endif
 
-    intdata = (unsigned int*)data;
     im = gdImageCreateTrueColor(width, height);
     for (y = 0; y < height; y++) {
         for (x = 0; x < width; x++) {
-           color = *intdata++;
+           color = *data++;
            /* gd's max alpha is 127 */
            if ((alpha = (color >> 25) & 0x7f))
                /* gd's alpha is transparency instead of opacity */
@@ -133,6 +135,7 @@ static void gd_format(GVJ_t * job, unsigned int width, unsigned int height, unsi
 }
 
 static gvdevice_engine_t gd_engine = {
+    NULL,
     NULL,
     gd_format,
     NULL,
index a1cf56a273ed3db98529f8c02e32108916796d9c..c848a4bd4f4747a15bbb8b12ab368f751e4d1afb 100644 (file)
@@ -108,7 +108,7 @@ static gdImagePtr gd_loadimage(GVJ_t * job, usershape_t *us)
 
 static void gd_loadimage_gd(GVJ_t * job, usershape_t *us, boxf b, boolean filled)
 {
-    gdImagePtr im3, im2 = NULL, im = (gdImagePtr) job->surface;
+    gdImagePtr im3, im2 = NULL, im = (gdImagePtr) job->context;
 
     if ((im2 = gd_loadimage(job, us))) {
         if (job->rotation) {
index 2e3f8f4511df76916845aa20a101dabc31d52b02..5d648099b4dc7abbf019c401cc98ea3317a9075e 100644 (file)
@@ -52,7 +52,7 @@ extern pointf Bezier(pointf * V, int degree, double t, pointf * Left, pointf * R
 
 static void gdgen_resolve_color(GVJ_t * job, gvcolor_t * color)
 {
-    gdImagePtr im = (gdImagePtr) job->surface;
+    gdImagePtr im = (gdImagePtr) job->context;
     int alpha;
 
     if (!im)
@@ -96,10 +96,10 @@ static void gdgen_begin_page(GVJ_t * job)
     if (GD_has_images(job->gvc->g))
        truecolor_p = TRUE;     /* force truecolor */
 
-    if (job->external_surface) {
+    if (job->external_context) {
        if (job->common->verbose)
            fprintf(stderr, "%s: using existing GD image\n", job->common->cmdname);
-       im = (gdImagePtr) (job->surface);
+       im = (gdImagePtr) (job->context);
     } else {
        if (truecolor_p) {
            if (job->common->verbose)
@@ -115,7 +115,7 @@ static void gdgen_begin_page(GVJ_t * job)
                        job->common->cmdname, ROUND(job->width * job->height / 1024.));
            im = gdImageCreate(job->width, job->height);
        }
-        job->surface = (void *) im;
+        job->context = (void *) im;
     }
 
     if (!im) {
@@ -147,11 +147,11 @@ static void gdgen_begin_page(GVJ_t * job)
 
 static void gdgen_end_page(GVJ_t * job)
 {
-    gdImagePtr im = (gdImagePtr) job->surface;
+    gdImagePtr im = (gdImagePtr) job->context;
 
     if (!im)
        return;
-    if (job->external_surface) {
+    if (job->external_context) {
        /* leave image in memory to be handled by Gdtclft output routines */
 #ifdef MYTRACE
        fprintf(stderr, "gdgen_end_graph (to memory)\n");
@@ -223,7 +223,7 @@ static void gdgen_end_page(GVJ_t * job)
 #ifdef MYTRACE
        fprintf(stderr, "gdgen_end_graph (to file)\n");
 #endif
-       job->surface = NULL;
+       job->context = NULL;
     }
 }
 
@@ -328,7 +328,7 @@ void gdgen_text(gdImagePtr im, pointf spf, pointf epf, int fontcolor, double fon
 
 static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
-    gdImagePtr im = (gdImagePtr) job->surface;
+    gdImagePtr im = (gdImagePtr) job->context;
     pointf spf, epf;
     double parawidth = para->width * job->scale.x;
 
@@ -417,7 +417,7 @@ gdgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
             int arrow_at_end, int filled)
 {
     obj_state_t *obj = job->obj;
-    gdImagePtr im = (gdImagePtr) job->surface;
+    gdImagePtr im = (gdImagePtr) job->context;
     pointf p0, p1, V[4];
     int i, j, step, pen;
     boolean pen_ok, fill_ok;
@@ -462,7 +462,7 @@ static int points_allocated;
 static void gdgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
 {
     obj_state_t *obj = job->obj;
-    gdImagePtr im = (gdImagePtr) job->surface;
+    gdImagePtr im = (gdImagePtr) job->context;
     gdImagePtr brush = NULL;
     int i;
     int pen;
@@ -497,7 +497,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)
 {
     obj_state_t *obj = job->obj;
-    gdImagePtr im = (gdImagePtr) job->surface;
+    gdImagePtr im = (gdImagePtr) job->context;
     double dx, dy;
     int pen;
     boolean pen_ok, fill_ok;
@@ -526,7 +526,7 @@ static void gdgen_ellipse(GVJ_t * job, pointf * A, int filled)
 
 static void gdgen_polyline(GVJ_t * job, pointf * A, int n)
 {
-    gdImagePtr im = (gdImagePtr) job->surface;
+    gdImagePtr im = (gdImagePtr) job->context;
     pointf p, p1;
     int i;
     int pen;
index 7782d1649d9327aa88374712e0129e2e34f63313..fd2e09bbc60c0bdb7e1e98b1ca54668a116fd8de 100644 (file)
@@ -106,7 +106,7 @@ writer ( const gchar *buf, gsize count, GError **error, gpointer data)
     return FALSE;
 }
 
-static void gdk_pixbuf_format(GVJ_t * job, unsigned int width, unsigned int height, unsigned char *data)
+static void gdk_pixbuf_format(GVJ_t * job)
 {
     char *format_str = "";
     GdkPixbuf *pixbuf;
@@ -138,16 +138,16 @@ static void gdk_pixbuf_format(GVJ_t * job, unsigned int width, unsigned int heig
        break;
     }
 
-    argb2rgba(width, height, data);
+    argb2rgba(job->width, job->height, job->imagedata);
 
     pixbuf = gdk_pixbuf_new_from_data(
-                data,                   // data
+                job->imagedata,         // data
                 GDK_COLORSPACE_RGB,     // colorspace
                 TRUE,                   // has_alpha
                 8,                      // bits_per_sample
-                width,                  // width
-                height,                 // height
-                4 * width,              // rowstride
+                job->width,             // width
+                job->height,            // height
+                4 * job->width,         // rowstride
                 NULL,                   // destroy_fn
                 NULL                    // destroy_fn_data
                );
@@ -158,6 +158,7 @@ static void gdk_pixbuf_format(GVJ_t * job, unsigned int width, unsigned int heig
 }
 
 static gvdevice_engine_t gdk_pixbuf_engine = {
+    NULL,
     NULL,
     gdk_pixbuf_format,
     NULL,
index deb5b035fdc1b5e7885febb5a8fdef382809fb41..d04789d257f8fcd250beba1065e5c3ca76ab2e22 100644 (file)
@@ -228,8 +228,8 @@ on_drawingarea1_expose_event           (GtkWidget       *widget,
 
     (job->callbacks->motion)(job, job->pointer);
 
-    job->surface = (void *)cr;
-    job->external_surface = TRUE;
+    job->context = (void *)cr;
+    job->external_context = TRUE;
     job->width = widget->allocation.width;
     job->height = widget->allocation.height;
     if (job->has_been_rendered) {
@@ -298,8 +298,8 @@ on_drawingarea2_expose_event           (GtkWidget       *widget,
 
     (job->callbacks->motion)(job, job->pointer);
 
-    job->surface = (void *)cr;
-    job->external_surface = TRUE;
+    job->context = (void *)cr;
+    job->external_context = TRUE;
     job->width = widget->allocation.width;
     job->height = widget->allocation.height;
 
index 4a47202fe8bcabc8c4b76f33085ba85098b38d06..f92ec1026e172c346df5547d5c00b6408cd1824a 100644 (file)
@@ -156,6 +156,7 @@ static gvdevice_features_t device_features_gtk = {
 static gvdevice_engine_t device_engine_gtk = {
     initialize_gtk,
     NULL,
+    NULL,
     finalize_gtk,
 };
 #endif
index 20aaa152b9e06e911e92c74241b4d911c8f87b50..da942e6a4e0c5573304e96942d26a263caf8e873 100644 (file)
@@ -41,21 +41,21 @@ static void ming_begin_job(GVJ_t * job)
     SWFMovie_setRate(movie, SWFFRAMERATE);
     SWFMovie_setDimension(movie, job->width, job->height);
 
-    job->surface = (void*) movie;
+    job->context = (void*) movie;
 }
 
 static void ming_end_job(GVJ_t * job)
 {
-    SWFMovie movie = (SWFMovie)(job->surface);
+    SWFMovie movie = (SWFMovie)(job->context);
 
     SWFMovie_output_to_stream(movie, job->output_file);
     destroySWFMovie(movie);
-    job->surface = NULL;
+    job->context = NULL;
 }
 
 static void ming_begin_page(GVJ_t * job)
 {
-//    SWFMovie movie = (SWFMovie)(job->surface);
+//    SWFMovie movie = (SWFMovie)(job->context);
 
 //    SWFMovie_setNumberOfFrames(movie, job->common->viewNum + 1);
 
@@ -68,7 +68,7 @@ static void ming_begin_page(GVJ_t * job)
 
 static void ming_end_page(GVJ_t * job)
 {
-    SWFMovie movie = (SWFMovie)(job->surface);
+    SWFMovie movie = (SWFMovie)(job->context);
 
     SWFMovie_nextFrame(movie);
 }
@@ -78,7 +78,7 @@ extern char* gvconfig_libdir(void);
 
 static void ming_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
-    SWFMovie movie = (SWFMovie)(job->surface);
+    SWFMovie movie = (SWFMovie)(job->context);
     SWFTextField textfield;
     SWFDisplayItem item;
     obj_state_t *obj = job->obj;
@@ -139,7 +139,7 @@ static void ming_textpara(GVJ_t * job, pointf p, textpara_t * para)
 
 static void ming_ellipse(GVJ_t * job, pointf * A, int filled)
 {
-    SWFMovie movie = (SWFMovie)(job->surface);
+    SWFMovie movie = (SWFMovie)(job->context);
     SWFShape shape;
     SWFFill fill;
     SWFDisplayItem item;
@@ -174,7 +174,7 @@ static void ming_ellipse(GVJ_t * job, pointf * A, int filled)
 static void
 ming_polygon(GVJ_t * job, pointf * A, int n, int filled)
 {
-    SWFMovie movie = (SWFMovie)(job->surface);
+    SWFMovie movie = (SWFMovie)(job->context);
     SWFShape shape;
     SWFFill fill;
     obj_state_t *obj = job->obj;
@@ -207,7 +207,7 @@ static void
 ming_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
                int arrow_at_end, int filled)
 {
-    SWFMovie movie = (SWFMovie)(job->surface);
+    SWFMovie movie = (SWFMovie)(job->context);
     SWFShape shape;
     obj_state_t *obj = job->obj;
     gvcolor_t pencolor = obj->pencolor;
@@ -229,7 +229,7 @@ ming_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
 static void
 ming_polyline(GVJ_t * job, pointf * A, int n)
 {
-    SWFMovie movie = (SWFMovie)(job->surface);
+    SWFMovie movie = (SWFMovie)(job->context);
     SWFShape shape;
     obj_state_t *obj = job->obj;
     gvcolor_t pencolor = obj->pencolor;
index 60aa2af442164040f3cb1d8d51661882c735fc68..d3c7c0f5d410f39e1dc6e7a2806a8861d673040b 100644 (file)
@@ -82,8 +82,8 @@ static cairo_surface_t* cairo_loadimage(GVJ_t * job, usershape_t *us)
 
 static void pango_loadimage_cairo(GVJ_t * job, usershape_t *us, boxf b, boolean filled)
 {
-    cairo_t *cr = (cairo_t *) job->surface; /* target context */
-    cairo_surface_t *surface = NULL; /* source surface */
+    cairo_t *cr = (cairo_t *) job->context; /* target context */
+    cairo_surface_t *surface;   /* source surface */
 
     surface = cairo_loadimage(job, us);
     if (surface) {
@@ -99,7 +99,7 @@ static void pango_loadimage_cairo(GVJ_t * job, usershape_t *us, boxf b, boolean
 
 static void pango_loadimage_ps(GVJ_t * job, usershape_t *us, boxf b, boolean filled)
 {
-    cairo_surface_t *surface = NULL; /* source surface */
+    cairo_surface_t *surface /* source surface */
     FILE *out = job->output_file;
     int X, Y, x, y, stride;
     unsigned char *data, *ix, alpha, red, green, blue;
index e65df32a5620470aae61d0249aa7ef165308613d..99d3e974d86e7438de8c93b28616b86205875d86 100644 (file)
@@ -131,8 +131,8 @@ static void cairogen_begin_page(GVJ_t * job)
     fedisableexcept(FE_ALL_EXCEPT);
 #endif
 
-    if (job->surface)
-        cr = (cairo_t *) job->surface;
+    if (job->context)
+        cr = (cairo_t *) job->context;
 
     switch (job->render.id) {
     case FORMAT_CAIRO:
@@ -141,6 +141,7 @@ static void cairogen_begin_page(GVJ_t * job)
            surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                        job->width, job->height);
            cr = cairo_create(surface);
+           job->imagedata = cairo_image_surface_get_data(surface);     
            cairo_surface_destroy (surface);
        }
        break;
@@ -171,7 +172,7 @@ static void cairogen_begin_page(GVJ_t * job)
     default:
        break;
     }
-    job->surface = (void *) cr;
+    job->context = (void *) cr;
 
     cairo_save(cr);
     cairo_scale(cr, job->scale.x, job->scale.y);
@@ -181,7 +182,7 @@ static void cairogen_begin_page(GVJ_t * job)
 
 static void cairogen_end_page(GVJ_t * job)
 {
-    cairo_t *cr = (cairo_t *) job->surface;
+    cairo_t *cr = (cairo_t *) job->context;
     cairo_surface_t *surface;
 
 
@@ -189,7 +190,6 @@ static void cairogen_end_page(GVJ_t * job)
 
 #ifdef CAIRO_HAS_PNG_FUNCTIONS
     case FORMAT_PNG:
-        surface = cairo_get_target(cr);
 #ifdef HAVE_SETMODE
 #ifdef O_BINARY
        /*
@@ -198,6 +198,7 @@ static void cairogen_end_page(GVJ_t * job)
        setmode(fileno(job->output_file), O_BINARY);
 #endif
 #endif
+        surface = cairo_get_target(cr);
        cairo_surface_write_to_png_stream(surface, writer, job->output_file);
        break;
 #endif
@@ -208,30 +209,16 @@ static void cairogen_end_page(GVJ_t * job)
        cairo_show_page(cr);
        break;
 
-    case FORMAT_CAIRO:
-       {
-           gvdevice_engine_t *gvde = job->device.engine;
-           unsigned int width, height;
-           unsigned char *data;
-           if (gvde && gvde->format) {
-                surface = cairo_get_target(cr);
-               width = cairo_image_surface_get_width(surface);
-               height = cairo_image_surface_get_height(surface);
-               data = cairo_image_surface_get_data(surface);
-               gvde->format(job, width, height, data);
-           }
-       }
-
+    case FORMAT_CAIRO:  /* formatting already done by gvdevice_format() */
     default:
        break;
     }
 
-    if (job->external_surface)
+    if (job->external_context)
        cairo_restore(cr);
     else {
        cairo_destroy(cr);
-       job->surface = NULL;
+       job->context = NULL;
     }
 
 #if defined HAVE_FENV_H && defined HAVE_FESETENV && defined HAVE_FEGETENV && defined(HAVE_FEENABLEEXCEPT)
@@ -243,7 +230,7 @@ static void cairogen_end_page(GVJ_t * job)
 static void cairogen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
     obj_state_t *obj = job->obj;
-    cairo_t *cr = (cairo_t *) job->surface;
+    cairo_t *cr = (cairo_t *) job->context;
     pointf offset;
     PangoLayout *layout = (PangoLayout*)(para->layout);
 
@@ -285,7 +272,7 @@ static void cairogen_set_penstyle(GVJ_t *job, cairo_t *cr)
 static void cairogen_ellipse(GVJ_t * job, pointf * A, int filled)
 {
     obj_state_t *obj = job->obj;
-    cairo_t *cr = (cairo_t *) job->surface;
+    cairo_t *cr = (cairo_t *) job->context;
     cairo_matrix_t matrix;
     double rx, ry;
 
@@ -315,7 +302,7 @@ static void
 cairogen_polygon(GVJ_t * job, pointf * A, int n, int filled)
 {
     obj_state_t *obj = job->obj;
-    cairo_t *cr = (cairo_t *) job->surface;
+    cairo_t *cr = (cairo_t *) job->context;
     int i;
 
     cairogen_set_penstyle(job, cr);
@@ -337,7 +324,7 @@ cairogen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
                int arrow_at_end, int filled)
 {
     obj_state_t *obj = job->obj;
-    cairo_t *cr = (cairo_t *) job->surface;
+    cairo_t *cr = (cairo_t *) job->context;
     int i;
 
     cairogen_set_penstyle(job, cr);
@@ -354,7 +341,7 @@ static void
 cairogen_polyline(GVJ_t * job, pointf * A, int n)
 {
     obj_state_t *obj = job->obj;
-    cairo_t *cr = (cairo_t *) job->surface;
+    cairo_t *cr = (cairo_t *) job->context;
     int i;
 
     cairogen_set_penstyle(job, cr);
index cd6068b15fa11f4c9a898a4a60325404d6b9555c..ea7a8071d25ec7772a01d29cd261ec1cd2a0e724 100644 (file)
@@ -263,7 +263,7 @@ static void update_display(GVJ_t *job, Display *dpy)
        surface = cairo_xlib_surface_create(dpy,
                        window->pix, window->visual,
                        job->width, job->height);
-       job->surface = (void *)cairo_create(surface);
+       job->context = (void *)cairo_create(surface);
        cairo_surface_destroy(surface);
         (job->callbacks->refresh)(job);
        XCopyArea(dpy, window->pix, window->win, window->gc,
@@ -584,6 +584,7 @@ static gvdevice_features_t device_features_xlib = {
 static gvdevice_engine_t device_engine_xlib = {
     initialize_xlib,
     NULL,
+    NULL,
     finalize_xlib,
 };
 #endif