From aa5fa8987b1ced5e4a3823625085deb9765976ff Mon Sep 17 00:00:00 2001 From: ellson Date: Wed, 3 Oct 2007 21:50:37 +0000 Subject: [PATCH] - fix for -Tgif:cairo on larger graphs - simplify gvdevice finalize a bit --- lib/gvc/gvdevice.c | 39 ++++++++++++++++------------------- plugin/pango/gvrender_pango.c | 15 +++++++------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/lib/gvc/gvdevice.c b/lib/gvc/gvdevice.c index 9143f3f11..b8e524b70 100644 --- a/lib/gvc/gvdevice.c +++ b/lib/gvc/gvdevice.c @@ -200,21 +200,20 @@ void gvdevice_format(GVJ_t * job) fflush(job->output_file); } -void gvdevice_finalize(GVJ_t * firstjob) +void gvdevice_finalize(GVJ_t * job) { - gvdevice_engine_t *gvde = firstjob->device.engine; - GVJ_t *job; + gvdevice_engine_t *gvde = job->device.engine; boolean finalized_p = FALSE; if (gvde) { if (gvde->finalize) { - gvde->finalize(firstjob); + gvde->finalize(job); finalized_p = TRUE; } } #ifdef WITH_CODEGENS else { - codegen_t *cg = firstjob->codegen; + codegen_t *cg = job->codegen; if (cg && cg->reset) cg->reset(); @@ -223,25 +222,23 @@ void gvdevice_finalize(GVJ_t * firstjob) if (! finalized_p) { /* if the device has no finalization then it uses file output */ - for (job = firstjob; job; job = job->next_active) { - if (job->flags & GVDEVICE_COMPRESSED_FORMAT) { + if (job->flags & GVDEVICE_COMPRESSED_FORMAT) { #ifdef HAVE_LIBZ - gzclose((gzFile *) (job->output_file)); - job->output_file = NULL; + gzclose((gzFile *) (job->output_file)); + job->output_file = NULL; #else - (job->common->errorfn) ("No libz support\n"); - exit(1); + (job->common->errorfn) ("No libz support\n"); + exit(1); #endif + } + if (job->output_filename + && job->output_file != stdout + && ! job->external_context) { + if (job->output_file) { + fclose(job->output_file); + job->output_file = NULL; } - if (job->output_filename - && job->output_file != stdout - && ! job->external_context) { - if (job->output_file) { - fclose(job->output_file); - job->output_file = NULL; - } - job->output_filename = NULL; - } - } + job->output_filename = NULL; + } } } diff --git a/plugin/pango/gvrender_pango.c b/plugin/pango/gvrender_pango.c index 43edfedfa..8121ed79f 100644 --- a/plugin/pango/gvrender_pango.c +++ b/plugin/pango/gvrender_pango.c @@ -142,6 +142,8 @@ static void cairogen_begin_page(GVJ_t * job) cairo_save(cr); } else { + if (cr) + cairo_destroy(cr); switch (job->render.id) { case FORMAT_PS: surface = cairo_ps_surface_create_for_stream (writer, @@ -160,7 +162,6 @@ static void cairogen_begin_page(GVJ_t * job) default: surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, job->width, job->height); - job->imagedata = cairo_image_surface_get_data(surface); break; } cr = cairo_create(surface); @@ -193,18 +194,18 @@ static void cairogen_end_page(GVJ_t * job) cairo_show_page(cr); break; - case FORMAT_CAIRO: /* formatting already done by gvdevice_format() */ + case FORMAT_CAIRO: default: + surface = cairo_get_target(cr); + job->imagedata = cairo_image_surface_get_data(surface); break; + /* formatting will be done by gvdevice_format() */ } - if (job->external_context) { + if (job->external_context) cairo_restore(cr); - } - else { - cairo_destroy(cr); + else job->context = NULL; - } #if 0 #if defined HAVE_FENV_H && defined HAVE_FESETENV && defined HAVE_FEGETENV && defined(HAVE_FEENABLEEXCEPT) -- 2.40.0