summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/japanese/gdev10v.c')
-rw-r--r--contrib/japanese/gdev10v.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/contrib/japanese/gdev10v.c b/contrib/japanese/gdev10v.c
index 510a74e8..f4c349d1 100644
--- a/contrib/japanese/gdev10v.c
+++ b/contrib/japanese/gdev10v.c
@@ -68,13 +68,26 @@ static dev_proc_print_page(bj10v_print_page);
static dev_proc_get_initial_matrix(bj10v_get_initial_matrix);
#endif
+static int
+bj10v_open(gx_device * pdev)
+{
+ if (pdev->HWResolution[0] < 180 ||
+ pdev->HWResolution[1] < 180)
+ {
+ emprintf(pdev->memory, "device requires a resolution of at least 180dpi\n");
+ return_error(gs_error_rangecheck);
+ }
+ return gdev_prn_open(pdev);
+}
+
+
#if 0
gx_device_procs prn_bj10v_procs =
prn_matrix_procs(gdev_prn_open, bj10v_get_initial_matrix,
gdev_prn_output_page, gdev_prn_close);
#endif
gx_device_procs prn_bj10v_procs =
- prn_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close);
+ prn_procs(bj10v_open, gdev_prn_output_page, gdev_prn_close);
gx_device_printer gs_bj10v_device =
prn_device(prn_bj10v_procs, "bj10v",
@@ -196,8 +209,8 @@ bj10v_output_run(byte *data, int dnum, int bytes,
static int
bj10v_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{ int line_size = gdev_prn_raster((gx_device *)pdev);
- int xres = pdev->x_pixels_per_inch;
- int yres = pdev->y_pixels_per_inch;
+ int xres = (int)pdev->x_pixels_per_inch;
+ int yres = (int)pdev->y_pixels_per_inch;
const char *mode = (yres == 180 ?
(xres == 180 ? "\052\047" : "\052\050") :
"|*");
@@ -206,7 +219,8 @@ bj10v_print_page(gx_device_printer *pdev, gp_file *prn_stream)
int x_skip_unit = bytes_per_column * (xres / 180);
int y_skip_unit = (yres / 180);
byte *in = (byte *)gs_malloc(pdev->memory->non_gc_memory, 8, line_size, "bj10v_print_page(in)");
- byte *out = (byte *)gs_malloc(pdev->memory->non_gc_memory, bits_per_column, line_size, "bj10v_print_page(out)");
+ /* We need one extra byte in <out> for our sentinel. */
+ byte *out = (byte *)gs_malloc(pdev->memory->non_gc_memory, bits_per_column * line_size + 1, 1, "bj10v_print_page(out)");
int lnum = 0;
int y_skip = 0;
int code = 0;