From 45e76c94479b71a08306265233a6952784b30e9b Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 30 Aug 2007 20:59:31 +0000 Subject: [PATCH] Call gvdevice_... plugin entry points from emit.c, rather than from another plugin. Rename job-surface to job->context. Add job->imagedata. --- lib/common/emit.c | 4 ++- lib/gvc/gvcjob.h | 5 +-- lib/gvc/gvcproc.h | 2 ++ lib/gvc/gvdevice.c | 25 +++++++++++---- lib/gvc/gvplugin_device.h | 3 +- plugin/devil/gvdevice_devil.c | 9 +++--- plugin/gd/gvdevice_gd.c | 11 ++++--- plugin/gd/gvloadimage_gd.c | 2 +- plugin/gd/gvrender_gd.c | 24 +++++++-------- plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c | 13 ++++---- plugin/gtk/callbacks.c | 8 ++--- plugin/gtk/gvdevice_gtk.c | 1 + plugin/ming/gvrender_ming.c | 20 ++++++------ plugin/pango/gvloadimage_pango.c | 6 ++-- plugin/pango/gvrender_pango.c | 41 +++++++++---------------- plugin/xlib/gvdevice_xlib.c | 3 +- 16 files changed, 95 insertions(+), 82 deletions(-) diff --git a/lib/common/emit.c b/lib/common/emit.c index 1a9c043ad..863d9e8ac 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -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); } diff --git a/lib/gvc/gvcjob.h b/lib/gvc/gvcjob.h index bf501086e..34a9495ec 100644 --- a/lib/gvc/gvcjob.h +++ b/lib/gvc/gvcjob.h @@ -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 */ diff --git a/lib/gvc/gvcproc.h b/lib/gvc/gvcproc.h index 3cd1bf28c..e8fbf6910 100644 --- a/lib/gvc/gvcproc.h +++ b/lib/gvc/gvcproc.h @@ -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 */ diff --git a/lib/gvc/gvdevice.c b/lib/gvc/gvdevice.c index b693390e3..8dd11e9fe 100644 --- a/lib/gvc/gvdevice.c +++ b/lib/gvc/gvdevice.c @@ -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; diff --git a/lib/gvc/gvplugin_device.h b/lib/gvc/gvplugin_device.h index d626e5e34..600bd490d 100644 --- a/lib/gvc/gvplugin_device.h +++ b/lib/gvc/gvplugin_device.h @@ -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); }; diff --git a/plugin/devil/gvdevice_devil.c b/plugin/devil/gvdevice_devil.c index 21110b806..545926449 100644 --- a/plugin/devil/gvdevice_devil.c +++ b/plugin/devil/gvdevice_devil.c @@ -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, diff --git a/plugin/gd/gvdevice_gd.c b/plugin/gd/gvdevice_gd.c index 8d876192d..98aacbb62 100644 --- a/plugin/gd/gvdevice_gd.c +++ b/plugin/gd/gvdevice_gd.c @@ -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, diff --git a/plugin/gd/gvloadimage_gd.c b/plugin/gd/gvloadimage_gd.c index a1cf56a27..c848a4bd4 100644 --- a/plugin/gd/gvloadimage_gd.c +++ b/plugin/gd/gvloadimage_gd.c @@ -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) { diff --git a/plugin/gd/gvrender_gd.c b/plugin/gd/gvrender_gd.c index 2e3f8f451..5d648099b 100644 --- a/plugin/gd/gvrender_gd.c +++ b/plugin/gd/gvrender_gd.c @@ -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; diff --git a/plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c b/plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c index 7782d1649..fd2e09bbc 100644 --- a/plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c +++ b/plugin/gdk_pixbuf/gvdevice_gdk_pixbuf.c @@ -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, diff --git a/plugin/gtk/callbacks.c b/plugin/gtk/callbacks.c index deb5b035f..d04789d25 100644 --- a/plugin/gtk/callbacks.c +++ b/plugin/gtk/callbacks.c @@ -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; diff --git a/plugin/gtk/gvdevice_gtk.c b/plugin/gtk/gvdevice_gtk.c index 4a47202fe..f92ec1026 100644 --- a/plugin/gtk/gvdevice_gtk.c +++ b/plugin/gtk/gvdevice_gtk.c @@ -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 diff --git a/plugin/ming/gvrender_ming.c b/plugin/ming/gvrender_ming.c index 20aaa152b..da942e6a4 100644 --- a/plugin/ming/gvrender_ming.c +++ b/plugin/ming/gvrender_ming.c @@ -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; diff --git a/plugin/pango/gvloadimage_pango.c b/plugin/pango/gvloadimage_pango.c index 60aa2af44..d3c7c0f5d 100644 --- a/plugin/pango/gvloadimage_pango.c +++ b/plugin/pango/gvloadimage_pango.c @@ -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; diff --git a/plugin/pango/gvrender_pango.c b/plugin/pango/gvrender_pango.c index e65df32a5..99d3e974d 100644 --- a/plugin/pango/gvrender_pango.c +++ b/plugin/pango/gvrender_pango.c @@ -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); diff --git a/plugin/xlib/gvdevice_xlib.c b/plugin/xlib/gvdevice_xlib.c index cd6068b15..ea7a8071d 100644 --- a/plugin/xlib/gvdevice_xlib.c +++ b/plugin/xlib/gvdevice_xlib.c @@ -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 -- 2.40.0