#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>
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)
{
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) {
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,