/*
- * "$Id: gdevcups.c,v 1.43.2.20 2003/08/26 21:15:48 mike Exp $"
+ * "$Id: gdevcups.c,v 1.43.2.21 2003/08/27 18:12:48 mike Exp $"
*
* GNU Ghostscript raster output driver for the Common UNIX Printing
* System (CUPS).
pdev->HWResolution[1] / 72.0f + 0.499f;
}
- fprintf(stderr, "DEBUG: Reallocating memory, [%.0f %.0f] = %dx%d pixels...\n",
- pdev->MediaSize[0], pdev->MediaSize[1], width, height);
+ /*
+ * Don't reallocate memory unless the device has been opened...
+ */
+
+ if (pdev->is_open)
+ {
+ /*
+ * Device is open, so reallocate...
+ */
- sp = ((gx_device_printer *)pdev)->space_params;
+ fprintf(stderr, "DEBUG: Reallocating memory, [%.0f %.0f] = %dx%d pixels...\n",
+ pdev->MediaSize[0], pdev->MediaSize[1], width, height);
- if ((code = gdev_prn_reallocate_memory(pdev, &sp, width, height)) < 0)
- return (code);
+ sp = ((gx_device_printer *)pdev)->space_params;
+
+ if ((code = gdev_prn_reallocate_memory(pdev, &sp, width, height)) < 0)
+ return (code);
+ }
+ else
+ {
+ /*
+ * Device isn't yet open, so just save the new width and height...
+ */
+
+ fprintf(stderr, "DEBUG: Setting initial media size, [%.0f %.0f] = %dx%d pixels...\n",
+ pdev->MediaSize[0], pdev->MediaSize[1], width, height);
+
+ pdev->width = width;
+ pdev->height = height;
+ }
}
#ifdef DEBUG
/*
- * End of "$Id: gdevcups.c,v 1.43.2.20 2003/08/26 21:15:48 mike Exp $".
+ * End of "$Id: gdevcups.c,v 1.43.2.21 2003/08/27 18:12:48 mike Exp $".
*/