]> granicus.if.org Git - graphviz/commitdiff
allow gd to produce larger bitmaps than cairo
authorellson <devnull@localhost>
Thu, 3 Dec 2009 03:10:22 +0000 (03:10 +0000)
committerellson <devnull@localhost>
Thu, 3 Dec 2009 03:10:22 +0000 (03:10 +0000)
plugin/gd/gvrender_gd.c
plugin/pango/gvrender_pango.c

index f2649f5cb1870637a09f14ef5fe6e1c3372e0595..55b729ea6ff9ff1f2e97c3198b0ec4678d17c28f 100644 (file)
 #endif
 #include <stdlib.h>
 #include <stddef.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
 #include <string.h>
 #include <fcntl.h>
 
@@ -72,8 +78,7 @@ static void gdgen_resolve_color(GVJ_t * job, gvcolor_t * color)
 
 static int white, black, transparent, basecolor;
 
-#define GD_XMAX 32767
-#define GD_YMAX 32767
+#define GD_XYMAX INT32_MAX
 
 static void gdgen_begin_page(GVJ_t * job)
 {
@@ -102,14 +107,13 @@ static void gdgen_begin_page(GVJ_t * job)
            fprintf(stderr, "%s: using existing GD image\n", job->common->cmdname);
        im = (gdImagePtr) (job->context);
     } else {
-        if (job->width >= GD_XMAX || job->height >= GD_YMAX) {
-           double scale = MIN((double)GD_XMAX / job->width,
-               (double)GD_YMAX / job->height);
+        if (job->width * job->height >= GD_XYMAX) {
+           double scale = sqrt(GD_XYMAX / (job->width * job->height));
            job->width *= scale;
            job->height *= scale;
            job->zoom *= scale;
            fprintf(stderr,
-               "%s: graph is too large for bitmap. Scaling by %g to fit\n",
+               "%s: graph is too large for gd-renderer bitmaps. Scaling by %g to fit\n",
                job->common->cmdname, scale);
        }
        if (truecolor_p) {
index 62a1d6d6727a801431100a35f11725703ea57046..cca99d02aada8528d1f9d8b345367f2f9bf58aad 100644 (file)
@@ -123,7 +123,7 @@ static void cairogen_begin_page(GVJ_t * job)
                job->scale.x *= scale;
                job->scale.y *= scale;
                 fprintf(stderr,
-                        "%s: graph is too large for bitmap. Scaling by %g to fit\n", 
+                        "%s: graph is too large for cairo-renderer bitmaps. Scaling by %g to fit\n", 
                         job->common->cmdname, scale);
            }
            surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,