From: ellson Date: Thu, 3 Dec 2009 03:10:22 +0000 (+0000) Subject: allow gd to produce larger bitmaps than cairo X-Git-Tag: LAST_LIBGRAPH~32^2~1539 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4998a3f13eb16063ce43b6a02a991459c9509985;p=graphviz allow gd to produce larger bitmaps than cairo --- diff --git a/plugin/gd/gvrender_gd.c b/plugin/gd/gvrender_gd.c index f2649f5cb..55b729ea6 100644 --- a/plugin/gd/gvrender_gd.c +++ b/plugin/gd/gvrender_gd.c @@ -23,6 +23,12 @@ #endif #include #include +#ifdef HAVE_STDINT_H +#include +#endif +#ifdef HAVE_INTTYPES_H +#include +#endif #include #include @@ -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) { diff --git a/plugin/pango/gvrender_pango.c b/plugin/pango/gvrender_pango.c index 62a1d6d67..cca99d02a 100644 --- a/plugin/pango/gvrender_pango.c +++ b/plugin/pango/gvrender_pango.c @@ -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,