]> granicus.if.org Git - graphviz/commitdiff
- update job->width, job->height to include margins.
authorellson <devnull@localhost>
Tue, 13 Jun 2006 22:31:14 +0000 (22:31 +0000)
committerellson <devnull@localhost>
Tue, 13 Jun 2006 22:31:14 +0000 (22:31 +0000)
- use job->width, job->height for initial canvas size.

lib/common/emit.c
plugin/gd/gvrender_gd.c
plugin/pango/gvrender_pango.c

index a9e12e273efe5f5ec011bacdf07e149420459bbb..76178b6b3f0bddaab7d8821e76b280ea38e74d38 100644 (file)
@@ -423,6 +423,10 @@ static void setup_page(GVJ_t * job, graph_t * g)
     else
         EXPANDBB(job->boundingBox, job->pageBoundingBox);
 
+    /* update job->width and job->height with margins */
+    job->width = job->boundingBox.UR.x + job->boundingBox.LL.x;
+    job->height = job->boundingBox.UR.y + job->boundingBox.LL.y;
+
     if (job->rotation) {
        if (job->flags & GVRENDER_Y_GOES_DOWN) {
            job->translation.x = -job->pageBox.UR.x - job->pageBoundingBox.LL.y / job->scale.y;
index f480d954fad7a11e80943d2ae01d49d62feed3db..bde97ee4a4e029acdd7b66179cddee429afb6440 100644 (file)
@@ -107,7 +107,6 @@ static void gdgen_begin_page(GVJ_t * job)
     bool bg_transparent_p = FALSE;
     int bgcolor = 0;
     gdImagePtr im = NULL;
-    int width, height;
 
 
 /* FIXME - ... */
@@ -131,23 +130,19 @@ static void gdgen_begin_page(GVJ_t * job)
            fprintf(stderr, "%s: using existing GD image\n", job->common->cmdname);
        im = (gdImagePtr) (job->output_file);
     } else {
-       /* device size with margins all around */
-       width = job->pageBoundingBox.UR.x + job->pageBoundingBox.LL.x;
-       height = job->pageBoundingBox.UR.y + job->pageBoundingBox.LL.y;
-
        if (truecolor_p) {
            if (job->common->verbose)
                fprintf(stderr,
                        "%s: allocating a %dK TrueColor GD image\n",
                        job->common->cmdname,
-                       ROUND(width * height * 4 / 1024.));
-           im = gdImageCreateTrueColor(width, height);
+                       ROUND(job->width * job->height * 4 / 1024.));
+           im = gdImageCreateTrueColor(job->width, job->height);
        } else {
            if (job->common->verbose)
                fprintf(stderr,
                        "%s: allocating a %dK PaletteColor GD image\n",
-                       job->common->cmdname, ROUND(width * height / 1024.));
-           im = gdImageCreate(width, height);
+                       job->common->cmdname, ROUND(job->width * job->height / 1024.));
+           im = gdImageCreate(job->width, job->height);
        }
     }
     job->surface = (void *) im;
index eb1bf74b6a2951646986d2c1bbbf166055c010be..83199516306fa2321a870f182744d8f818274b35 100644 (file)
@@ -128,7 +128,6 @@ static void cairogen_begin_page(GVJ_t * job)
 {
     cairo_t *cr;
     cairo_surface_t *surface;
-    double width, height;
 
 #if defined(HAVE_FENV_H) && defined(HAVE_FESETENV) && defined(HAVE_FEGETENV) && defined(HAVE_FEDISABLEEXCEPT)
     /* cairo generates FE_INVALID and other exceptions we 
@@ -141,16 +140,12 @@ static void cairogen_begin_page(GVJ_t * job)
 
     cr = (cairo_t *) job->surface; /* might be NULL */
 
-    /* device size with margins all around */
-    width = job->pageBoundingBox.UR.x + job->pageBoundingBox.LL.x;
-    height = job->pageBoundingBox.UR.y + job->pageBoundingBox.LL.y;
-
     switch (job->render.id) {
 #ifdef CAIRO_HAS_PNG_FUNCTIONS
     case FORMAT_PNG:
        if (!cr) {
            surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-                       width, height);
+                       (double)(job->width), (double)(job->height));
            cr = cairo_create(surface);
            cairo_surface_destroy (surface);
        }
@@ -160,7 +155,7 @@ static void cairogen_begin_page(GVJ_t * job)
     case FORMAT_PS:
        if (!cr) {
            surface = cairo_ps_surface_create_for_stream (writer,
-                       job->output_file, width, height);
+                       job->output_file, (double)(job->width), (double)(job->height));
            cr = cairo_create(surface);
            cairo_surface_destroy (surface);
        }
@@ -170,7 +165,7 @@ static void cairogen_begin_page(GVJ_t * job)
     case FORMAT_PDF:
        if (!cr) {
            surface = cairo_pdf_surface_create_for_stream (writer,
-                       job->output_file, width, height);
+                       job->output_file, (double)(job->width), (double)(job->height));
            cr = cairo_create(surface);
            cairo_surface_destroy (surface);
        }
@@ -180,7 +175,7 @@ static void cairogen_begin_page(GVJ_t * job)
     case FORMAT_SVG:
        if (!cr) {
            surface = cairo_svg_surface_create_for_stream (writer,
-                       job->output_file, width, height);
+                       job->output_file, (double)(job->width), (double)(job->height));
            cr = cairo_create(surface);
            cairo_surface_destroy (surface);
        }