]> granicus.if.org Git - graphviz/commitdiff
- fix for -Tgif:cairo on larger graphs
authorellson <devnull@localhost>
Wed, 3 Oct 2007 21:50:37 +0000 (21:50 +0000)
committerellson <devnull@localhost>
Wed, 3 Oct 2007 21:50:37 +0000 (21:50 +0000)
- simplify gvdevice finalize a bit

lib/gvc/gvdevice.c
plugin/pango/gvrender_pango.c

index 9143f3f114fcfdcfdb4cd114d3598a273a8fccc0..b8e524b7048fd92ff4d8df095a4a19a0feebd46f 100644 (file)
@@ -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;
+       }
     }
 }
index 43edfedfaf545304b916d59f322de0666bfedaaf..8121ed79f181c0d71b91f429554fea7a4f0dbf88 100644 (file)
@@ -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)