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();
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;
+ }
}
}
cairo_save(cr);
}
else {
+ if (cr)
+ cairo_destroy(cr);
switch (job->render.id) {
case FORMAT_PS:
surface = cairo_ps_surface_create_for_stream (writer,
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);
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)