diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2021-09-27 11:19:24 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2021-10-20 18:22:47 +0200 |
commit | cc6be9c3577168805ec34b2d396e63361012282b (patch) | |
tree | 7dc794b08a1a6a786d540516c623cb1eebfb1863 /contrib | |
parent | Import Ghostscript 9.54 (diff) | |
download | ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.tar.gz ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.tar.bz2 ghostscript-gpl-patches-cc6be9c3577168805ec34b2d396e63361012282b.zip |
Import Ghostscript 9.55ghostscript-9.55
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'contrib')
33 files changed, 850 insertions, 1055 deletions
diff --git a/contrib/eplaser/gdevescv.c b/contrib/eplaser/gdevescv.c index c7bd29e1..4150e81f 100644 --- a/contrib/eplaser/gdevescv.c +++ b/contrib/eplaser/gdevescv.c @@ -35,40 +35,10 @@ #include <stdlib.h> /* for abs() and free */ -/* Get this definition in before we read memento.h */ -static void -unvectored_free(void *x) -{ - free(x); -} - -#if ( 6 > GS_VERSION_MAJOR ) - -#include <string.h> -#include <sys/utsname.h> /* for uname(2) */ -#include <ctype.h> /* for toupper(3) */ - -#include "math_.h" -#include "gx.h" -#include "gserrors.h" -#include "gsmatrix.h" -#include "gsparam.h" -#include "gxdevice.h" -#include "gscspace.h" -#include "gsutil.h" -#include "gdevvec.h" -#include "gdevpstr.h" -#include "ghost.h" -#include "gzstate.h" - -#include "gdevescv.h" -#include "gspath.h" -#include "gzpath.h" - -#else /* 6 <= GS_VERSION_MAJOR */ - #include "math_.h" +#ifndef _WIN32 #include <sys/utsname.h> /* for uname(2) */ +#endif #include <ctype.h> /* for toupper(3) */ #include "time_.h" @@ -79,14 +49,10 @@ unvectored_free(void *x) #include "gxdevice.h" #include "gdevvec.h" -#if ( 7 >= GS_VERSION_MAJOR ) #include "gscspace.h" -#endif #include "gdevescv.h" -#endif /* GS_VERSION_MAJOR */ - #define ESCV_FORCEDRAWPATH 0 /* 0: correct LP-9200C path trouble. */ /* ---------------- Device definition ---------------- */ @@ -100,7 +66,7 @@ static dev_proc_copy_color(escv_copy_color); static dev_proc_put_params(escv_put_params); static dev_proc_get_params(escv_get_params); static dev_proc_fill_mask(escv_fill_mask); -static dev_proc_begin_image(escv_begin_image); +static dev_proc_begin_typed_image(escv_begin_typed_image); gs_public_st_suffix_add0_final(st_device_escv, gx_device_escv, "gx_device_escv", device_escv_enum_ptrs, device_escv_reloc_ptrs, @@ -110,18 +76,18 @@ gs_public_st_suffix_add0_final(st_device_escv, gx_device_escv, ** 原点の値を 0 とした場合,計算誤差?の問題から描画エリアが狂うため ** 原点を 0.001 としておく。 */ -#define escv_device_full_body(dtype, pprocs, dname, stype, w, h, xdpi, ydpi, \ +#define escv_device_full_body(dtype, init, dname, stype, w, h, xdpi, ydpi, \ ncomp, depth, mg, mc, dg, dc, lm, bm, rm, tm)\ - std_device_part1_(dtype, pprocs, dname, stype, open_init_closed),\ + std_device_part1_(dtype, init, dname, stype, open_init_closed),\ dci_values(ncomp, depth, mg, mc, dg, dc),\ std_device_part2_(w, h, xdpi, ydpi),\ offset_margin_values(0.001, 0.001, lm, 0, 0, tm),\ std_device_part3_() /* for ESC/Page (Monochrome) */ -#define esmv_device_full_body(dtype, pprocs, dname, stype, w, h, xdpi, ydpi, \ +#define esmv_device_full_body(dtype, init, dname, stype, w, h, xdpi, ydpi, \ ncomp, depth, mg, mc, dg, dc, lm, bm, rm, tm)\ - std_device_part1_(dtype, pprocs, dname, stype, open_init_closed),\ + std_device_part1_(dtype, init, dname, stype, open_init_closed),\ dci_values(ncomp, depth, mg, mc, dg, dc),\ std_device_part2_(w, h, xdpi, ydpi),\ offset_margin_values(-lm * xdpi / 72.0, -tm * ydpi / 72.0, 5.0 / (MMETER_PER_INCH / POINT),\ @@ -129,83 +95,80 @@ gs_public_st_suffix_add0_final(st_device_escv, gx_device_escv, std_device_part3_() /* for ESC/Page-Color */ -#define escv_device_body(name) \ - escv_device_full_body(gx_device_escv, 0, name, \ - &st_device_escv,\ -/* width & height */ ESCPAGE_DEFAULT_WIDTH, ESCPAGE_DEFAULT_HEIGHT,\ -/* default resolution */ X_DPI, Y_DPI,\ -/* color info */ 3, 24, 255, 255, 256, 256,\ - ESCPAGE_LEFT_MARGIN_DEFAULT,\ - ESCPAGE_BOTTOM_MARGIN_DEFAULT,\ - ESCPAGE_RIGHT_MARGIN_DEFAULT,\ - ESCPAGE_TOP_MARGIN_DEFAULT) +#define escv_device_body(name) \ +{\ + escv_device_full_body(gx_device_escv, escv_initialize_device_procs,\ + name, &st_device_escv,\ +/* width & height */ ESCPAGE_DEFAULT_WIDTH, ESCPAGE_DEFAULT_HEIGHT,\ +/* default resolution */X_DPI, Y_DPI,\ +/* color info */ 3, 24, 255, 255, 256, 256,\ + ESCPAGE_LEFT_MARGIN_DEFAULT,\ + ESCPAGE_BOTTOM_MARGIN_DEFAULT,\ + ESCPAGE_RIGHT_MARGIN_DEFAULT,\ + ESCPAGE_TOP_MARGIN_DEFAULT),\ + { 0 },\ + escv_init_code\ +} /* for ESC/Page (Monochrome) */ -#define esmv_device_body(name) \ - esmv_device_full_body(gx_device_escv, 0, name, \ - &st_device_escv,\ -/* width & height */ ESCPAGE_DEFAULT_WIDTH, ESCPAGE_DEFAULT_HEIGHT,\ -/* default resolution */ X_DPI, Y_DPI,\ -/* color info */ 1, 8, 255, 255, 256, 256,\ - ESCPAGE_LEFT_MARGIN_DEFAULT,\ - ESCPAGE_BOTTOM_MARGIN_DEFAULT,\ - ESCPAGE_RIGHT_MARGIN_DEFAULT,\ - ESCPAGE_TOP_MARGIN_DEFAULT) - -#define escv_procs_part1 \ - escv_open, /* open_device */\ - gx_default_get_initial_matrix, /* get_initial_matrix */\ - NULL, /* sync_output */\ - escv_output_page, /* output_page */\ - escv_close /* close_device */ - -#define escv_procs_part2 \ - gdev_vector_fill_rectangle, /* fill_rectangle */\ - NULL, /* tile_rectangle */\ - escv_copy_mono, /* dev_t_proc_copy_mono */\ - escv_copy_color, /* dev_t_proc_copy_color */\ - NULL, /* draw_line */\ - NULL, /* get_bits */\ - escv_get_params, /* dev_t_proc_get_params */\ - escv_put_params, /* dev_t_proc_put_params */\ - NULL, /* map_cmyk_color */\ - NULL, /* get_xfont_procs */\ - NULL, /* get_xfont_device */\ - NULL, /* map_rgb_alpha_color */\ - gx_page_device_get_page_device, /* dev_t_proc_get_page_device */\ - NULL, /* get_alpha_bits */\ - NULL, /* copy_alpha */\ - NULL, /* get_band */\ - NULL, /* copy_rop */\ - gdev_vector_fill_path, /* fill_path */\ - gdev_vector_stroke_path, /* stroke_path */\ - escv_fill_mask, /* fill_mask */\ - gdev_vector_fill_trapezoid, /* fill_trapezoid */\ - gdev_vector_fill_parallelogram, /* fill_parallelogram */\ - gdev_vector_fill_triangle, /* fill_triangle */\ - NULL, /****** WRONG ******/ /* draw_thin_line */\ - escv_begin_image, /* begin_image */\ - NULL, /* image_data */\ - NULL, /* end_image */\ - NULL, /* strip_tile_rectangle */\ - NULL /******strip_copy_rop******/ +#define esmv_device_body(name) \ +{\ + esmv_device_full_body(gx_device_escv, esmv_initialize_device_procs,\ + name, &st_device_escv,\ +/* width & height */ ESCPAGE_DEFAULT_WIDTH, ESCPAGE_DEFAULT_HEIGHT,\ +/* default resolution */X_DPI, Y_DPI,\ +/* color info */ 1, 8, 255, 255, 256, 256,\ + ESCPAGE_LEFT_MARGIN_DEFAULT,\ + ESCPAGE_BOTTOM_MARGIN_DEFAULT,\ + ESCPAGE_RIGHT_MARGIN_DEFAULT,\ + ESCPAGE_TOP_MARGIN_DEFAULT),\ + { 0 },\ + esmv_init_code\ +} + +static void +esc_initialize_device_procs(gx_device *dev) +{ + set_dev_proc(dev, open_device, escv_open); + set_dev_proc(dev, output_page, escv_output_page); + set_dev_proc(dev, close_device, escv_close); + set_dev_proc(dev, fill_rectangle, gdev_vector_fill_rectangle); + set_dev_proc(dev, copy_mono, escv_copy_mono); + set_dev_proc(dev, copy_color, escv_copy_color); + set_dev_proc(dev, get_params, escv_get_params); + set_dev_proc(dev, put_params, escv_put_params); + set_dev_proc(dev, get_page_device, gx_page_device_get_page_device); + set_dev_proc(dev, fill_path, gdev_vector_fill_path); + set_dev_proc(dev, stroke_path, gdev_vector_stroke_path); + set_dev_proc(dev, fill_mask, escv_fill_mask); + set_dev_proc(dev, fill_trapezoid, gdev_vector_fill_trapezoid); + set_dev_proc(dev, fill_parallelogram, gdev_vector_fill_parallelogram); + set_dev_proc(dev, fill_triangle, gdev_vector_fill_triangle); + set_dev_proc(dev, begin_typed_image, escv_begin_typed_image); +} /* for ESC/Page-Color */ -#define escv_procs \ -{\ - escv_procs_part1,\ - gx_default_rgb_map_rgb_color, /* map_rgb_color */\ - gx_default_rgb_map_color_rgb, /* map_color_rgb */\ - escv_procs_part2\ +static void +escv_initialize_device_procs(gx_device *dev) +{ + set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color); + set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb); + set_dev_proc(dev, encode_color, gx_default_rgb_map_rgb_color); + set_dev_proc(dev, decode_color, gx_default_rgb_map_color_rgb); + + esc_initialize_device_procs(dev); } /* for ESC/Page (Monochrome) */ -#define esmv_procs \ -{\ - escv_procs_part1,\ - gx_default_gray_map_rgb_color, /* map_rgb_color */\ - gx_default_gray_map_color_rgb, /* map_color_rgb */\ - escv_procs_part2\ +static void +esmv_initialize_device_procs(gx_device *dev) +{ + set_dev_proc(dev, map_rgb_color, gx_default_gray_map_rgb_color); + set_dev_proc(dev, map_color_rgb, gx_default_gray_map_color_rgb); + set_dev_proc(dev, encode_color, gx_default_gray_encode_color); + set_dev_proc(dev, decode_color, gx_default_gray_decode_color); + + esc_initialize_device_procs(dev); } #define escv_init_code_common \ @@ -279,94 +242,62 @@ gs_public_st_suffix_add0_final(st_device_escv, gx_device_escv, escv_init_code_common /* for ESC/Page (Monochrome) */ -gx_device_escv far_data gs_epl2050_device ={esmv_device_body("epl2050"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_epl2050p_device={esmv_device_body("epl2050p"),esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_epl2120_device ={esmv_device_body("epl2120"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_epl2500_device ={esmv_device_body("epl2500"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_epl2750_device ={esmv_device_body("epl2750"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_epl5800_device ={esmv_device_body("epl5800"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_epl5900_device ={esmv_device_body("epl5900"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_epl6100_device ={esmv_device_body("epl6100"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_epl6200_device ={esmv_device_body("epl6200"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp1800_device ={esmv_device_body("lp1800"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp1900_device ={esmv_device_body("lp1900"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp2200_device ={esmv_device_body("lp2200"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp2400_device ={esmv_device_body("lp2400"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp2500_device ={esmv_device_body("lp2500"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp7500_device ={esmv_device_body("lp7500"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp7700_device ={esmv_device_body("lp7700"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp7900_device ={esmv_device_body("lp7900"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp8100_device ={esmv_device_body("lp8100"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp8300f_device ={esmv_device_body("lp8300f"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp8400f_device ={esmv_device_body("lp8400f"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp8600_device ={esmv_device_body("lp8600"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp8600f_device ={esmv_device_body("lp8600f"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp8700_device ={esmv_device_body("lp8700"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp8900_device ={esmv_device_body("lp8900"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp9000b_device ={esmv_device_body("lp9000b"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp9100_device ={esmv_device_body("lp9100"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp9200b_device ={esmv_device_body("lp9200b"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp9300_device ={esmv_device_body("lp9300"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp9400_device ={esmv_device_body("lp9400"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp9600_device ={esmv_device_body("lp9600"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lp9600s_device ={esmv_device_body("lp9600s"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_lps4500_device ={esmv_device_body("lps4500"), esmv_procs, esmv_init_code}; -gx_device_escv far_data gs_eplmono_device ={esmv_device_body(ESCPAGE_DEVICENAME_MONO), esmv_procs, esmv_init_code}; +gx_device_escv far_data gs_epl2050_device = esmv_device_body("epl2050"); +gx_device_escv far_data gs_epl2050p_device= esmv_device_body("epl2050p"); +gx_device_escv far_data gs_epl2120_device = esmv_device_body("epl2120"); +gx_device_escv far_data gs_epl2500_device = esmv_device_body("epl2500"); +gx_device_escv far_data gs_epl2750_device = esmv_device_body("epl2750"); +gx_device_escv far_data gs_epl5800_device = esmv_device_body("epl5800"); +gx_device_escv far_data gs_epl5900_device = esmv_device_body("epl5900"); +gx_device_escv far_data gs_epl6100_device = esmv_device_body("epl6100"); +gx_device_escv far_data gs_epl6200_device = esmv_device_body("epl6200"); +gx_device_escv far_data gs_lp1800_device = esmv_device_body("lp1800"); +gx_device_escv far_data gs_lp1900_device = esmv_device_body("lp1900"); +gx_device_escv far_data gs_lp2200_device = esmv_device_body("lp2200"); +gx_device_escv far_data gs_lp2400_device = esmv_device_body("lp2400"); +gx_device_escv far_data gs_lp2500_device = esmv_device_body("lp2500"); +gx_device_escv far_data gs_lp7500_device = esmv_device_body("lp7500"); +gx_device_escv far_data gs_lp7700_device = esmv_device_body("lp7700"); +gx_device_escv far_data gs_lp7900_device = esmv_device_body("lp7900"); +gx_device_escv far_data gs_lp8100_device = esmv_device_body("lp8100"); +gx_device_escv far_data gs_lp8300f_device = esmv_device_body("lp8300f"); +gx_device_escv far_data gs_lp8400f_device = esmv_device_body("lp8400f"); +gx_device_escv far_data gs_lp8600_device = esmv_device_body("lp8600"); +gx_device_escv far_data gs_lp8600f_device = esmv_device_body("lp8600f"); +gx_device_escv far_data gs_lp8700_device = esmv_device_body("lp8700"); +gx_device_escv far_data gs_lp8900_device = esmv_device_body("lp8900"); +gx_device_escv far_data gs_lp9000b_device = esmv_device_body("lp9000b"); +gx_device_escv far_data gs_lp9100_device = esmv_device_body("lp9100"); +gx_device_escv far_data gs_lp9200b_device = esmv_device_body("lp9200b"); +gx_device_escv far_data gs_lp9300_device = esmv_device_body("lp9300"); +gx_device_escv far_data gs_lp9400_device = esmv_device_body("lp9400"); +gx_device_escv far_data gs_lp9600_device = esmv_device_body("lp9600"); +gx_device_escv far_data gs_lp9600s_device = esmv_device_body("lp9600s"); +gx_device_escv far_data gs_lps4500_device = esmv_device_body("lps4500"); +gx_device_escv far_data gs_eplmono_device = esmv_device_body(ESCPAGE_DEVICENAME_MONO); /* for ESC/Page-Color */ -gx_device_escv far_data gs_alc1900_device ={escv_device_body("alc1900"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_alc2000_device ={escv_device_body("alc2000"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_alc4000_device ={escv_device_body("alc4000"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_alc4100_device ={escv_device_body("alc4100"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_alc8500_device ={escv_device_body("alc8500"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_alc8600_device ={escv_device_body("alc8600"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_alc9100_device ={escv_device_body("alc9100"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp3000c_device ={escv_device_body("lp3000c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp8000c_device ={escv_device_body("lp8000c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp8200c_device ={escv_device_body("lp8200c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp8300c_device ={escv_device_body("lp8300c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp8500c_device ={escv_device_body("lp8500c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp8800c_device ={escv_device_body("lp8800c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp9000c_device ={escv_device_body("lp9000c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp9200c_device ={escv_device_body("lp9200c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp9500c_device ={escv_device_body("lp9500c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lp9800c_device ={escv_device_body("lp9800c"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_lps6500_device ={escv_device_body("lps6500"), escv_procs, escv_init_code}; -gx_device_escv far_data gs_eplcolor_device ={escv_device_body(ESCPAGE_DEVICENAME_COLOR), escv_procs, escv_init_code}; +gx_device_escv far_data gs_alc1900_device = escv_device_body("alc1900"); +gx_device_escv far_data gs_alc2000_device = escv_device_body("alc2000"); +gx_device_escv far_data gs_alc4000_device = escv_device_body("alc4000"); +gx_device_escv far_data gs_alc4100_device = escv_device_body("alc4100"); +gx_device_escv far_data gs_alc8500_device = escv_device_body("alc8500"); +gx_device_escv far_data gs_alc8600_device = escv_device_body("alc8600"); +gx_device_escv far_data gs_alc9100_device = escv_device_body("alc9100"); +gx_device_escv far_data gs_lp3000c_device = escv_device_body("lp3000c"); +gx_device_escv far_data gs_lp8000c_device = escv_device_body("lp8000c"); +gx_device_escv far_data gs_lp8200c_device = escv_device_body("lp8200c"); +gx_device_escv far_data gs_lp8300c_device = escv_device_body("lp8300c"); +gx_device_escv far_data gs_lp8500c_device = escv_device_body("lp8500c"); +gx_device_escv far_data gs_lp8800c_device = escv_device_body("lp8800c"); +gx_device_escv far_data gs_lp9000c_device = escv_device_body("lp9000c"); +gx_device_escv far_data gs_lp9200c_device = escv_device_body("lp9200c"); +gx_device_escv far_data gs_lp9500c_device = escv_device_body("lp9500c"); +gx_device_escv far_data gs_lp9800c_device = escv_device_body("lp9800c"); +gx_device_escv far_data gs_lps6500_device = escv_device_body("lps6500"); +gx_device_escv far_data gs_eplcolor_device= escv_device_body(ESCPAGE_DEVICENAME_COLOR); /* Vector device implementation */ -#if ( 6 > GS_VERSION_MAJOR ) -static int escv_beginpage(P1(gx_device_vector * vdev)); -static int escv_setfillcolor(P2(gx_device_vector * vdev, const gx_drawing_color * pdc)); -static int escv_setstrokecolor(P2(gx_device_vector * vdev, const gx_drawing_color * pdc)); -static int escv_setdash(P4(gx_device_vector * vdev, const float *pattern, - uint count, double offset)); -static int escv_setflat(P2(gx_device_vector * vdev, double flatness)); -static int escv_setlogop(P3(gx_device_vector * vdev, gs_logical_operation_t lop, - gs_logical_operation_t diff)); -static int escv_vector_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1, - fixed y1, gx_path_type_t type); -static int escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath, - gx_path_type_t type); -static int escv_beginpath(P2(gx_device_vector * vdev, gx_path_type_t type)); -static int escv_moveto(P6(gx_device_vector * vdev, double x0, double y0, - double x, double y, gx_path_type_t type)); -static int escv_lineto(P6(gx_device_vector * vdev, double x0, double y0, - double x, double y, gx_path_type_t type)); -static int escv_curveto(P10(gx_device_vector * vdev, double x0, double y0, - double x1, double y1, double x2, double y2, - double x3, double y3, gx_path_type_t type)); -static int escv_closepath(P6(gx_device_vector * vdev, double x, double y, - double x_start, double y_start, gx_path_type_t type)); - -static int escv_endpath(P2(gx_device_vector * vdev, gx_path_type_t type)); -static int escv_setlinewidth(gx_device_vector * vdev, double width); -static int escv_setlinecap(gx_device_vector * vdev, gs_line_cap cap); -static int escv_setlinejoin(gx_device_vector * vdev, gs_line_join join); -static int escv_setmiterlimit(gx_device_vector * vdev, double limit); - -#else /* 6 <= GS_VERSION_MAJOR */ - /* Page management */ static int escv_beginpage (gx_device_vector * vdev); /* Imager state */ @@ -380,17 +311,12 @@ static int escv_setflat (gx_device_vector * vdev, double flatness); static int escv_setlogop (gx_device_vector * vdev, gs_logical_operation_t lop, gs_logical_operation_t diff); /* Other state */ -#if ( 8 <= GS_VERSION_MAJOR ) static bool escv_can_handle_hl_color (gx_device_vector * vdev, const gs_gstate * pgs, const gx_drawing_color * pdc); static int escv_setfillcolor (gx_device_vector * vdev, const gs_gstate * pgs, const gx_drawing_color * pdc); static int escv_setstrokecolor (gx_device_vector * vdev, const gs_gstate * pgs, const gx_drawing_color * pdc); -#else -static int escv_setfillcolor (gx_device_vector * vdev, const gx_drawing_color * pdc); -static int escv_setstrokecolor (gx_device_vector * vdev, const gx_drawing_color * pdc); -#endif /* Paths */ /* dopath and dorect are normally defaulted */ static int escv_vector_dopath (gx_device_vector * vdev, const gx_path * ppath, @@ -409,7 +335,6 @@ static int escv_closepath (gx_device_vector * vdev, double x0, double y0, double x_start, double y_start, gx_path_type_t type); static int escv_endpath (gx_device_vector * vdev, gx_path_type_t type); -#endif /* GS_VERSION_MAJOR */ static const gx_device_vector_procs escv_vector_procs = { @@ -424,9 +349,7 @@ static const gx_device_vector_procs escv_vector_procs = escv_setflat, escv_setlogop, /* Other state */ -#if ( 8 <= GS_VERSION_MAJOR ) escv_can_handle_hl_color, /* add gs815 */ -#endif escv_setfillcolor, /* fill & stroke colors are the same */ escv_setstrokecolor, /* Paths */ @@ -511,10 +434,7 @@ escv_range_check(gx_device * dev) static int escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath, - gx_path_type_t type -#if ( 6 <= GS_VERSION_MAJOR ) - , const gs_matrix *pmat -#endif + gx_path_type_t type, const gs_matrix *pmat ) { gx_device_escv *pdev = (gx_device_escv *) vdev; @@ -827,6 +747,9 @@ escv_checkpapersize(gx_device_vector * vdev) static char * get_sysname ( void ) { +#ifdef _WIN32 + return strdup("BOGUS"); +#else char *result = NULL; struct utsname utsn; @@ -835,6 +758,7 @@ get_sysname ( void ) result = strdup (utsn.sysname); } return result; +#endif } /* EPSON printer model name translation. @@ -1032,8 +956,7 @@ escv_beginpage(gx_device_vector * vdev) if (sysname) { lputs(s, sysname ); - /* Carefully avoid memento interfering here. */ - unvectored_free(sysname); + free(sysname); sysname = NULL; } } @@ -1320,19 +1243,6 @@ escv_setlinewidth(gx_device_vector * vdev, double width) gx_device_escv *const pdev = (gx_device_escv *) vdev; char obuf[64]; -#if GS_VERSION_MAJOR == 5 - /* Scale を掛けているのは, Ghostscript 5.10/5.50 のバグのため */ - double xscale, yscale; - - xscale = fabs(igs->ctm.xx); - yscale = fabs(igs->ctm.xy); - - if (xscale == 0 || yscale > xscale) /* if portrait */ - width = ceil(width * yscale); - else - width = ceil(width * xscale); -#endif - if (width < 1) width = 1; /* ESC/Page では線幅/終端/接合部の設定は1つのコマンドになっているため保持しておく。 */ @@ -1425,20 +1335,16 @@ escv_setmiterlimit(gx_device_vector * vdev, double limit) return 0; } -#if ( 8 <= GS_VERSION_MAJOR ) static bool escv_can_handle_hl_color(gx_device_vector * vdev, const gs_gstate * pgs, const gx_drawing_color * pdc) { return false; } -#endif static int escv_setfillcolor(gx_device_vector * vdev, -#if ( 8 <= GS_VERSION_MAJOR ) const gs_gstate * pgs, -#endif const gx_drawing_color * pdc) { stream *s = gdev_vector_stream(vdev); @@ -1479,9 +1385,7 @@ escv_setfillcolor(gx_device_vector * vdev, static int escv_setstrokecolor(gx_device_vector * vdev, -#if ( 8 <= GS_VERSION_MAJOR ) const gs_gstate * pgs, -#endif const gx_drawing_color * pdc) { stream *s = gdev_vector_stream(vdev); @@ -1532,18 +1436,6 @@ escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, double o int i; char obuf[64]; -#if GS_VERSION_MAJOR == 5 - float scale, xscale, yscale; - /* Scale を掛けているのは, Ghostscript 5.10/5.50 のバグのため */ - xscale = fabs(igs->ctm.xx); - yscale = fabs(igs->ctm.xy); - - if (xscale == 0) /* if portrait */ - scale = yscale; - else - scale = xscale; -#endif - if (count == 0){ /* 実線 */ lputs(s, ESC_GS "0;0lpG"); @@ -1555,13 +1447,7 @@ escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, double o if (count) { if (count == 1) { -#if GS_VERSION_MAJOR == 5 - (void)gs_sprintf(obuf, ESC_GS "1;%d;%ddlG", - (int)(pattern[0] * scale / vdev->x_pixels_per_inch + 0.5), - (int)(pattern[0] * scale / vdev->x_pixels_per_inch + 0.5)); -#else (void)gs_sprintf(obuf, ESC_GS "1;%d;%ddlG", (int) pattern[0], (int) pattern[0]); -#endif lputs(s, obuf); } else { /* pattern に0があった場合は描画不可として返却 */ @@ -1571,12 +1457,7 @@ escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, double o lputs(s, ESC_GS "1"); for (i = 0; i < count; ++i) { -#if GS_VERSION_MAJOR == 5 - (void)gs_sprintf(obuf, ";%d", (int)(pattern[i] * scale / vdev->x_pixels_per_inch + 0.5)); - -#else (void)gs_sprintf(obuf, ";%d", (int) pattern[i]); -#endif lputs(s, obuf); } lputs(s, "dlG"); @@ -2171,19 +2052,14 @@ escv_copy_mono(gx_device * dev, const byte * data, gx_color_index c_color = 0; char obuf[128]; int depth = 1; -#if ( 8 <= GS_VERSION_MAJOR ) - /* FIXME! add for gs815 */ const gs_gstate * pgs = (const gs_gstate *)0; -#endif if (id != gs_no_id && zero == gx_no_color_index && one != gx_no_color_index && data_x == 0) { gx_drawing_color dcolor; color_set_pure(&dcolor, one); escv_setfillcolor(vdev, -#if ( 8 <= GS_VERSION_MAJOR ) pgs, -#endif &dcolor); /* FIXME! gs815 */ } @@ -2269,9 +2145,7 @@ escv_copy_mono(gx_device * dev, const byte * data, } color_set_pure(&color, one); code = gdev_vector_update_fill_color((gx_device_vector *) pdev, -#if ( 8 <= GS_VERSION_MAJOR ) pgs, -#endif &color); /* ここを通過したら以下の色設定は無意味? */ @@ -2383,18 +2257,13 @@ escv_fill_mask(gx_device * dev, gx_color_index color = gx_dc_pure_color(pdcolor); char obuf[64]; -#if ( 8 <= GS_VERSION_MAJOR ) - /* FIXME! add for gs815 */ const gs_gstate * pgs = (const gs_gstate *)0; -#endif if (w <= 0 || h <= 0) return 0; if (depth > 1 || gdev_vector_update_fill_color(vdev, -#if ( 8 <= GS_VERSION_MAJOR ) pgs, -#endif pdcolor) < 0 || gdev_vector_update_clip_path(vdev, pcpath) < 0 || gdev_vector_update_log_op(vdev, lop) < 0 @@ -2494,23 +2363,25 @@ static const gx_image_enum_procs_t escv_image_enum_procs = /* Start processing an image. */ static int -escv_begin_image(gx_device * dev, - const gs_gstate * pgs, const gs_image_t * pim, - gs_image_format_t format, const gs_int_rect * prect, - const gx_drawing_color * pdcolor, const gx_clip_path * pcpath, - gs_memory_t * mem, gx_image_enum_common_t **pinfo) +escv_begin_typed_image(gx_device *dev, + const gs_gstate *pgs, + const gs_matrix *pmat, + const gs_image_common_t *pic, + const gs_int_rect *prect, + const gx_drawing_color *pdcolor, + const gx_clip_path *pcpath, + gs_memory_t *mem, + gx_image_enum_common_t **pinfo) { + const gs_image_t *pim = (const gs_image_t *)pic; gx_device_vector *const vdev = (gx_device_vector *) dev; gx_device_escv *const pdev = (gx_device_escv *) dev; - stream *s = gdev_vector_stream((gx_device_vector *) pdev); - gdev_vector_image_enum_t *pie = - gs_alloc_struct(mem, gdev_vector_image_enum_t, &st_vector_image_enum, "escv_begin_image"); - const gs_color_space *pcs = pim->ColorSpace; + stream *s; + gdev_vector_image_enum_t *pie; + const gs_color_space *pcs; gs_color_space_index index; int num_components = 1; - bool can_do = prect == 0 && - (pim->format == gs_image_format_chunky || - pim->format == gs_image_format_component_planar); + bool can_do; gs_matrix imat; int code; @@ -2518,10 +2389,24 @@ escv_begin_image(gx_device * dev, char obuf[128]; - if (pie == 0) return_error(gs_error_VMerror); + s = gdev_vector_stream((gx_device_vector *) pdev); + pie = gs_alloc_struct(mem, gdev_vector_image_enum_t, + &st_vector_image_enum, "escv_begin_typed_image"); + if (pie == NULL) return_error(gs_error_VMerror); pie->memory = mem; - code = gdev_vector_begin_image(vdev, pgs, pim, format, prect, - pdcolor, pcpath, mem, &escv_image_enum_procs, pie); + + /* This code can only cope with type1 images. Anything else, we need + * to send to the default. */ + if (pic->type->index != 1) + goto fallback; + + can_do = prect == NULL && + (pim->format == gs_image_format_chunky || + pim->format == gs_image_format_component_planar); + pcs = pim->ColorSpace; + code = gdev_vector_begin_image(vdev, pgs, pim, pim->format, prect, + pdcolor, pcpath, mem, + &escv_image_enum_procs, pie); if (code < 0) return code; *pinfo = (gx_image_enum_common_t *) pie; @@ -2551,8 +2436,10 @@ escv_begin_image(gx_device * dev, } } if (!can_do) { - return gx_default_begin_image(dev, pgs, pim, format, prect, - pdcolor, pcpath, mem, &pie->default_info); +fallback: + return gx_default_begin_typed_image(dev, pgs, pmat, pic, prect, + pdcolor, pcpath, mem, + &pie->default_info); } if (pim->ImageMask || (pim->BitsPerComponent == 1 && num_components == 1)) { @@ -2573,7 +2460,9 @@ escv_begin_image(gx_device * dev, if (code < 0) return code; - gs_matrix_multiply(&imat, &ctm_only(pgs), &imat); + if (pmat == NULL) + pmat = &ctm_only(pgs); + gs_matrix_multiply(&imat, pmat, &imat); ty = imat.ty; bx = imat.xx * pim->Width + imat.yx * pim->Height + imat.tx; @@ -2667,15 +2556,9 @@ escv_begin_image(gx_device * dev, /* Process the next piece of an image. */ static int -#if GS_VERSION_MAJOR >= 6 escv_image_plane_data(gx_image_enum_common_t *info, const gx_image_plane_t *planes, int height, int *rows_used) -#else - escv_image_plane_data(gx_device *dev, gx_image_enum_common_t *info, const gx_image_plane_t *planes, int height) -#endif { -#if GS_VERSION_MAJOR >= 6 gx_device *dev = info->dev; -#endif gx_device_vector *const vdev = (gx_device_vector *) dev; gx_device_escv *const pdev = (gx_device_escv *) dev; gdev_vector_image_enum_t *pie = (gdev_vector_image_enum_t *) info; @@ -2691,10 +2574,8 @@ escv_image_plane_data(gx_image_enum_common_t *info, const gx_image_plane_t *plan { -#if GS_VERSION_MAJOR >= 6 if (height == 260) height = 1; -#endif width_bytes = (pie->width * pie->bits_per_pixel / pdev->ncomp + 7) / 8 * pdev->ncomp; tbyte = width_bytes * height; buf = gs_alloc_bytes(vdev->memory, tbyte, "escv_image_data(buf)"); @@ -2881,15 +2762,9 @@ escv_image_plane_data(gx_image_enum_common_t *info, const gx_image_plane_t *plan } static int -#if GS_VERSION_MAJOR >= 6 escv_image_end_image(gx_image_enum_common_t * info, bool draw_last) -#else - escv_image_end_image(gx_device *dev, gx_image_enum_common_t * info, bool draw_last) -#endif { -#if GS_VERSION_MAJOR >= 6 gx_device *dev = info->dev; -#endif gx_device_vector *const vdev = (gx_device_vector *) dev; gx_device_escv *const pdev = (gx_device_escv *) dev; gdev_vector_image_enum_t *pie = (gdev_vector_image_enum_t *) info; diff --git a/contrib/gdevadmp.c b/contrib/gdevadmp.c index 6648dffe..9e3d74a4 100644 --- a/contrib/gdevadmp.c +++ b/contrib/gdevadmp.c @@ -119,7 +119,7 @@ static dev_proc_print_page(dmp_print_page); /* Standard DMP device */ const gx_device_printer far_data gs_appledmp_device = -prn_device(prn_bg_procs, "appledmp", /* The print_page proc is compatible with allowing bg printing */ +prn_device(gdev_prn_initialize_device_procs_mono_bg, "appledmp", /* The print_page proc is compatible with allowing bg printing */ 85, /* width_10ths, 8.5" */ 110, /* height_10ths, 11" */ 120, 72, /* X_DPI, Y_DPI */ @@ -128,7 +128,7 @@ prn_device(prn_bg_procs, "appledmp", /* The print_page proc is compatible with a /* lowrez Imagewriter device */ const gx_device_printer far_data gs_iwlo_device = -prn_device(prn_bg_procs, "iwlo", /* The print_page proc is compatible with allowing bg printing */ +prn_device(gdev_prn_initialize_device_procs_mono_bg, "iwlo", /* The print_page proc is compatible with allowing bg printing */ 85, /* width_10ths, 8.5" */ 110, /* height_10ths, 11" */ 160, 72, /* X_DPI, Y_DPI */ @@ -137,7 +137,7 @@ prn_device(prn_bg_procs, "iwlo", /* The print_page proc is compatible with allow /* hirez Imagewriter device */ const gx_device_printer far_data gs_iwhi_device = -prn_device(prn_bg_procs, "iwhi", /* The print_page proc is compatible with allowing bg printing */ +prn_device(gdev_prn_initialize_device_procs_mono_bg, "iwhi", /* The print_page proc is compatible with allowing bg printing */ 85, /* width_10ths, 8.5" */ 110, /* height_10ths, 11" */ 160, 144, /* X_DPI, Y_DPI */ @@ -146,7 +146,7 @@ prn_device(prn_bg_procs, "iwhi", /* The print_page proc is compatible with allow /* LQ hirez Imagewriter device */ const gx_device_printer far_data gs_iwlq_device = -prn_device(prn_bg_procs, "iwlq", /* The print_page proc is compatible with allowing bg printing */ +prn_device(gdev_prn_initialize_device_procs_mono_bg, "iwlq", /* The print_page proc is compatible with allowing bg printing */ 85, /* width_10ths, 8.5" */ 110, /* height_10ths, 11" */ 320, 216, diff --git a/contrib/gdevbjc_.c b/contrib/gdevbjc_.c index a661ba0d..a880aaa1 100644 --- a/contrib/gdevbjc_.c +++ b/contrib/gdevbjc_.c @@ -211,13 +211,22 @@ static media_t media_codes[] = { /* ------------------------- 1 bit Monochrome ---------------------------- */ /***************************************************************************/ -static const gx_device_procs bjcmono_procs = -prn_color_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close, - NULL, NULL, - gdev_bjc_get_params, gdev_bjc_put_params); +static void +bjcmono_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, get_params, gdev_bjc_get_params); + set_dev_proc(dev, put_params, gdev_bjc_put_params); + set_dev_proc(dev, map_color_rgb, gx_default_w_b_map_color_rgb); + set_dev_proc(dev, map_rgb_color, gx_default_gray_fast_encode); + set_dev_proc(dev, encode_color, gx_default_gray_fast_encode); + set_dev_proc(dev, decode_color, gx_default_w_b_map_color_rgb); +} + const gx_device_bjc_printer gs_bjcmono_device = -bjc_device(bjcmono_procs, "bjcmono", +bjc_device(bjcmono_initialize_device_procs, "bjcmono", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI, (float)(3.4 / 25.4), (float)(7.0 / 25.4), @@ -234,13 +243,23 @@ bjc_device(bjcmono_procs, "bjcmono", /* -------------------------- 8 bit Grayscale ---------------------------- */ /***************************************************************************/ -static const gx_device_procs bjcgray_procs = -prn_color_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close, - gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb, - gdev_bjc_get_params, gdev_bjc_put_params); +static void +bjcgray_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_gray(dev); + + set_dev_proc(dev, get_params, gdev_bjc_get_params); + set_dev_proc(dev, put_params, gdev_bjc_put_params); + + /* The prn macros used in previous versions of the code leave + * encode_color and decode_color set to NULL (which are then rewritten + * by the system to the default. For compatibility we do the same. */ + set_dev_proc(dev, encode_color, NULL); + set_dev_proc(dev, decode_color, NULL); +} const gx_device_bjc_printer gs_bjcgray_device = -bjc_device(bjcgray_procs, "bjcgray", +bjc_device(bjcgray_initialize_device_procs, "bjcgray", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI, (float)(3.4 / 25.4), (float)(7.0 / 25.4), @@ -257,13 +276,23 @@ bjc_device(bjcgray_procs, "bjcgray", /* --------------------------- 3 bit CMYK Color -------------------------- */ /***************************************************************************/ -static const gx_device_procs bjc_cmykcolor_procs = -bjc_cmyk_param_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close, - cmyk_1bit_map_color_rgb, cmyk_1bit_map_cmyk_color, - gdev_bjc_get_params, gdev_bjc_put_params); +static void +bjccmyk_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_cmyk1(dev); + + set_dev_proc(dev, get_params, gdev_bjc_get_params); + set_dev_proc(dev, put_params, gdev_bjc_put_params); + + /* The prn macros used in previous versions of the code leave + * encode_color and decode_color set to NULL (which are then rewritten + * by the system to the default. For compatibility we do the same. */ + set_dev_proc(dev, encode_color, NULL); + set_dev_proc(dev, decode_color, NULL); +} const gx_device_bjc_printer gs_bjccmyk_device = -bjc_device(bjc_cmykcolor_procs, "bjccmyk", +bjc_device(bjccmyk_initialize_device_procs, "bjccmyk", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI, (float)(3.4 / 25.4), (float)(7.0 / 25.4), @@ -280,13 +309,23 @@ bjc_device(bjc_cmykcolor_procs, "bjccmyk", /* --------------------------- 24 bit TrueColor -------------------------- */ /***************************************************************************/ -static const gx_device_procs bjc_truecolor_procs = -bjc_cmyk_param_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close, - cmyk_8bit_map_color_rgb, cmyk_8bit_map_cmyk_color, - gdev_bjc_get_params, gdev_bjc_put_params); +static void +bjc_truecolor_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_cmyk8(dev); + + set_dev_proc(dev, get_params, gdev_bjc_get_params); + set_dev_proc(dev, put_params, gdev_bjc_put_params); + + /* The prn macros used in previous versions of the code leave + * encode_color and decode_color set to NULL (which are then rewritten + * by the system to the default. For compatibility we do the same. */ + set_dev_proc(dev, encode_color, NULL); + set_dev_proc(dev, decode_color, NULL); +} const gx_device_bjc_printer gs_bjccolor_device = -bjc_device(bjc_truecolor_procs, "bjccolor", +bjc_device(bjc_truecolor_initialize_device_procs, "bjccolor", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI, (float)(3.4 / 25.4), (float)(7.0 / 25.4), diff --git a/contrib/gdevbjc_.h b/contrib/gdevbjc_.h index b40c6fc4..fb6cfa5f 100644 --- a/contrib/gdevbjc_.h +++ b/contrib/gdevbjc_.h @@ -168,14 +168,6 @@ typedef struct gx_device_bjc_printer_s gx_device_bjc_printer; bjc_device_margins(procs, dname, w10, h10, xdpi, ydpi,\ lm, tm, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page, def_ink) -#define bjc_cmyk_param_procs(v_prn_open, v_prn_output_page, v_prn_close, \ - p_map_color_rgb, p_map_cmyk_color, \ - v_prn_get_params, v_prn_put_params)\ - {v_prn_open, NULL, NULL, v_prn_output_page, v_prn_close,\ - NULL, p_map_color_rgb, NULL, NULL, NULL, NULL, NULL, NULL,\ - v_prn_get_params, v_prn_put_params,\ - p_map_cmyk_color, NULL, NULL, NULL, gx_page_device_get_page_device} - /* There are the definitions of commands for the Canon BJC printers. */ #define BJC_BJL_CLEANING 0x00 /* "@Cleaning=1\n" */ diff --git a/contrib/gdevcd8.c b/contrib/gdevcd8.c index 23532c0f..e6e9a942 100644 --- a/contrib/gdevcd8.c +++ b/contrib/gdevcd8.c @@ -701,26 +701,6 @@ typedef struct { terminate_page\ } -#define cmyk_colour_procs(proc_colour_open, proc_get_params, proc_put_params, \ - map_rgb_color, map_color_rgb, map_cmyk_color)\ -{ proc_colour_open,\ - gx_default_get_initial_matrix,\ - gx_default_sync_output,\ - gdev_prn_output_page,\ - gdev_prn_close,\ - map_rgb_color,\ - map_color_rgb,\ - NULL /* fill_rectangle */,\ - NULL /* tile_rectangle */,\ - NULL /* copy_mono */,\ - NULL /* copy_color */,\ - NULL /* draw_line */,\ - gx_default_get_bits,\ - proc_get_params,\ - proc_put_params,\ - map_cmyk_color\ -} - /* Printer-specific functions. Most printers are handled by the cdj850_xx() * functions. */ @@ -788,61 +768,101 @@ static void static void cdnj500_terminate_page(gx_device_printer * pdev, gp_file * prn_stream); -static const gx_device_procs cdj670_procs = -cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, - NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color); +/* This decoding to RGB and conversion to CMYK simulates what */ +/* gx_default_decode_color does without calling the map_color_rgb method. */ +static int +cdj670_compatible_cmyk_decode_color(gx_device *dev, gx_color_index color, gx_color_value cv[4]) +{ + int i, code = gdev_cmyk_map_color_rgb(dev, color, cv); + gx_color_value min_val = gx_max_color_value; -static const gx_device_procs cdj850_procs = -cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, - NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color); + for (i = 0; i < 3; i++) { + if ((cv[i] = gx_max_color_value - cv[i]) < min_val) + min_val = cv[i]; + } + for (i = 0; i < 3; i++) + cv[i] -= min_val; + cv[3] = min_val; -static const gx_device_procs cdj880_procs = -cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, - NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color); + return code; +} -static const gx_device_procs cdj890_procs = -cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, - NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color); -static const gx_device_procs cdj1600_procs = -cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, - gdev_pcl_map_rgb_color, gdev_pcl_map_color_rgb, NULL); +static void +cdj670_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, hp_colour_open); + set_dev_proc(dev, map_rgb_color, gx_error_encode_color); + set_dev_proc(dev, map_color_rgb, gdev_cmyk_map_color_rgb); + set_dev_proc(dev, get_params, cdj850_get_params); + set_dev_proc(dev, put_params, cdj850_put_params); + set_dev_proc(dev, map_cmyk_color, gdev_cmyk_map_cmyk_color); + set_dev_proc(dev, encode_color, gdev_cmyk_map_cmyk_color); + set_dev_proc(dev, decode_color, cdj670_compatible_cmyk_decode_color); +} + +static void +cdj1600_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, hp_colour_open); + set_dev_proc(dev, map_rgb_color, gdev_pcl_map_rgb_color); + set_dev_proc(dev, map_color_rgb, gdev_pcl_map_color_rgb); + set_dev_proc(dev, get_params, cdj850_get_params); + set_dev_proc(dev, put_params, cdj850_put_params); + set_dev_proc(dev, map_cmyk_color, gx_error_encode_color); + set_dev_proc(dev, encode_color, gdev_pcl_map_rgb_color); + set_dev_proc(dev, decode_color, gdev_pcl_map_color_rgb); +} -/* HP2200 and DNJ500 is a RGB printer */ -static const gx_device_procs chp2200_procs = -cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params, - gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb, NULL); +static void +chp2200_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, hp_colour_open); + set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color); + set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb); + set_dev_proc(dev, get_params, cdj850_get_params); + set_dev_proc(dev, put_params, cdj850_put_params); + set_dev_proc(dev, map_cmyk_color, gx_error_encode_color); + set_dev_proc(dev, encode_color, gx_default_rgb_map_rgb_color); + set_dev_proc(dev, decode_color, gx_default_rgb_map_color_rgb); +} const gx_device_cdj850 gs_cdj670_device = -cdj_850_device(cdj670_procs, "cdj670", 600, 600, 32, cdj850_print_page, 0, +cdj_850_device(cdj670_initialize_device_procs, "cdj670", 600, 600, 32, cdj850_print_page, 0, PRESENTATION, PLAIN_PAPER, 2, DJ670C, 9, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, cdj850_start_raster_mode, cdj850_print_non_blank_lines, cdj850_terminate_page); const gx_device_cdj850 gs_cdj850_device = -cdj_850_device(cdj850_procs, "cdj850", 600, 600, 32, cdj850_print_page, 0, +cdj_850_device(cdj670_initialize_device_procs, "cdj850", 600, 600, 32, cdj850_print_page, 0, PRESENTATION, PLAIN_PAPER, 4, DJ850C, 9, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, cdj850_start_raster_mode, cdj850_print_non_blank_lines, cdj850_terminate_page); const gx_device_cdj850 gs_cdj880_device = -cdj_850_device(cdj880_procs, "cdj880", 600, 600, 32, cdj850_print_page, 0, +cdj_850_device(cdj670_initialize_device_procs, "cdj880", 600, 600, 32, cdj850_print_page, 0, PRESENTATION, PLAIN_PAPER, 4, DJ880C, 2, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, cdj880_start_raster_mode, cdj880_print_non_blank_lines, cdj880_terminate_page); const gx_device_cdj850 gs_cdj890_device = -cdj_850_device(cdj890_procs, "cdj890", 600, 600, 32, cdj850_print_page, 0, +cdj_850_device(cdj670_initialize_device_procs, "cdj890", 600, 600, 32, cdj850_print_page, 0, PRESENTATION, PLAIN_PAPER, 4, DJ890C, 9, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, cdj850_start_raster_mode, cdj850_print_non_blank_lines, cdj850_terminate_page); const gx_device_cdj850 gs_cdj1600_device = -cdj_1600_device(cdj1600_procs, "cdj1600", 300, 300, 24, cdj850_print_page, 0, +cdj_1600_device(cdj1600_initialize_device_procs, "cdj1600", 300, 300, 24, cdj850_print_page, 0, PRESENTATION, PLAIN_PAPER, 2, DJ1600C, 3, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, cdj1600_start_raster_mode, cdj1600_print_non_blank_lines, @@ -850,7 +870,7 @@ cdj_1600_device(cdj1600_procs, "cdj1600", 300, 300, 24, cdj850_print_page, 0, /* HP2200 does not need color matching and halftoning parameters */ const gx_device_cdj850 gs_chp2200_device = -chp_2200_device(chp2200_procs, "chp2200", 300, 300, 24, chp2200_print_page, 0, +chp_2200_device(chp2200_initialize_device_procs, "chp2200", 300, 300, 24, chp2200_print_page, 0, NORMAL, PLAIN_PAPER, 0 /*unused*/, HP2200C, 10, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, /*all unused*/ chp2200_start_raster_mode, NULL /*unused*/, @@ -858,7 +878,7 @@ chp_2200_device(chp2200_procs, "chp2200", 300, 300, 24, chp2200_print_page, 0, /* DNJ500 does not need color matching and halftoning parameters */ const gx_device_cdj850 gs_cdnj500_device = -chp_2200_device(chp2200_procs, "cdnj500", 300, 300, 24, cdnj500_print_page, 0, +chp_2200_device(chp2200_initialize_device_procs, "cdnj500", 300, 300, 24, cdnj500_print_page, 0, NORMAL, PLAIN_PAPER, 0 /*unused*/, DNJ500C, 10, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, /*all unused*/ cdnj500_start_raster_mode, NULL /*unused*/, diff --git a/contrib/gdevdj9.c b/contrib/gdevdj9.c index efbeaef5..29e66824 100644 --- a/contrib/gdevdj9.c +++ b/contrib/gdevdj9.c @@ -510,24 +510,39 @@ typedef struct terminate_page\ } -#define cmyk_colour_procs(proc_colour_open, proc_get_params, proc_put_params, \ - proc_colour_close, map_rgb_color, map_color_rgb, map_cmyk_color) {\ - proc_colour_open,\ - gx_default_get_initial_matrix,\ - gx_default_sync_output,\ - gdev_prn_output_page,\ - proc_colour_close,\ - map_rgb_color,\ - map_color_rgb,\ - NULL /* fill_rectangle */,\ - NULL /* tile_rectangle */,\ - NULL /* copy_mono */,\ - NULL /* copy_color */,\ - NULL /* draw_line */,\ - gx_default_get_bits,\ - proc_get_params,\ - proc_put_params,\ - map_cmyk_color\ +/* This decoding to RGB and conversion to CMYK simulates what */ +/* gx_default_decode_color does without calling the map_color_rgb method. */ +static int +cdj970_compatible_cmyk_decode_color(gx_device *dev, gx_color_index color, gx_color_value cv[4]) +{ + int i, code = gdev_cmyk_map_color_rgb(dev, color, cv); + gx_color_value min_val = gx_max_color_value; + + for (i = 0; i < 3; i++) { + if ((cv[i] = gx_max_color_value - cv[i]) < min_val) + min_val = cv[i]; + } + for (i = 0; i < 3; i++) + cv[i] -= min_val; + cv[3] = min_val; + + return code; +} + +static void +cdj970_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, hp_colour_open); + set_dev_proc(dev, close_device, cdj970_close); + set_dev_proc(dev, map_rgb_color, gx_error_encode_color); + set_dev_proc(dev, map_color_rgb, gdev_cmyk_map_color_rgb); + set_dev_proc(dev, get_params, cdj970_get_params); + set_dev_proc(dev, put_params, cdj970_put_params); + set_dev_proc(dev, map_cmyk_color, gdev_cmyk_map_cmyk_color); + set_dev_proc(dev, encode_color, gdev_cmyk_map_cmyk_color); + set_dev_proc(dev, decode_color, cdj970_compatible_cmyk_decode_color); } static void @@ -543,13 +558,9 @@ cdj970_print_non_blank_lines(gx_device_printer * pdev, static void cdj970_terminate_page(gx_device_printer * pdev, gp_file * prn_stream); -static const gx_device_procs cdj970_procs = -cmyk_colour_procs(hp_colour_open, cdj970_get_params, cdj970_put_params, - cdj970_close, NULL, gdev_cmyk_map_color_rgb, - gdev_cmyk_map_cmyk_color); - const gx_device_cdj970 gs_cdj970_device = -cdj_970_device(cdj970_procs, "cdj970", 600, 600, 32, cdj970_print_page, 0, +cdj_970_device(cdj970_initialize_device_procs, "cdj970", + 600, 600, 32, cdj970_print_page, 0, NORMAL, PLAIN_PAPER, NONE, 4, DJ970C, 2, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, cdj970_start_raster_mode, cdj970_print_non_blank_lines, diff --git a/contrib/gdevgdi.c b/contrib/gdevgdi.c index cdd148ba..cfe69a41 100644 --- a/contrib/gdevgdi.c +++ b/contrib/gdevgdi.c @@ -94,12 +94,17 @@ static dev_proc_open_device(gdi_open); static dev_proc_close_device(gdi_close); static dev_proc_print_page(gdi_print_page); -static gx_device_procs prn_gdi_procs = - prn_params_procs(gdi_open, gdev_prn_output_page, gdi_close, - gdev_prn_get_params, gdev_prn_put_params); +static void +gdi_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, gdi_open); + set_dev_proc(dev, close_device, gdi_close); +} gx_device_printer far_data gs_gdi_device = - prn_device(prn_gdi_procs, "gdi", + prn_device(gdi_initialize_device_procs, "gdi", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* paper size (unit : 10/72 inch size) */ X_DPI2, Y_DPI2, 0.20, 0.25, 0.25, 0.25, /* margins filled in by gdi_open */ @@ -107,7 +112,7 @@ gx_device_printer far_data gs_gdi_device = gdi_print_page); gx_device_printer far_data gs_samsunggdi_device = - prn_device(prn_gdi_procs, "samsunggdi", + prn_device(gdi_initialize_device_procs, "samsunggdi", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* paper size (unit : 10/72 inch size) */ X_DPI2, Y_DPI2, 0.20, 0.25, 0.25, 0.25, /* margins filled in by gdi_open */ diff --git a/contrib/gdevhl12.c b/contrib/gdevhl12.c index 9f4d617c..860d365a 100644 --- a/contrib/gdevhl12.c +++ b/contrib/gdevhl12.c @@ -159,12 +159,20 @@ static dev_proc_print_page_copies(hl1250_print_page_copies); static dev_proc_get_params(hl1250_get_params); static dev_proc_put_params(hl1250_put_params); -static const gx_device_procs prn_hl1250_procs = -prn_params_procs(hl1250_open, gdev_prn_output_page, hl1250_close, - hl1250_get_params, hl1250_put_params); +static void +hl1250_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, hl1250_open); + set_dev_proc(dev, close_device, hl1250_close); + set_dev_proc(dev, get_params, hl1250_get_params); + set_dev_proc(dev, put_params, hl1250_put_params); +} #define hl1250_device_copies(dname, xdpi, ydpi)\ -{ prn_device_std_body_copies(gx_device_hl1250, prn_hl1250_procs,\ +{ prn_device_std_body_copies(gx_device_hl1250,\ + hl1250_initialize_device_procs,\ dname,\ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,\ xdpi, ydpi,\ diff --git a/contrib/gdevln03.c b/contrib/gdevln03.c index 88cf8a1f..c5f087e3 100644 --- a/contrib/gdevln03.c +++ b/contrib/gdevln03.c @@ -48,10 +48,16 @@ static int sixel_print_page(gx_device_printer *pdev, gp_file *prn_stream, /* The device descriptor */ static dev_proc_output_page(sixel_output_page); static dev_proc_print_page(ln03_print_page); + /* We have to supply our own procs, since we have to intercept */ /* output_page so we can open the printer in text mode. */ -static gx_device_procs sixel_procs = - prn_procs(gdev_prn_open, sixel_output_page, gdev_prn_close); +static void +sixel_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, output_page, sixel_output_page); +} #ifdef A4 # define BOTTOM_MARGIN 0.5 @@ -59,7 +65,7 @@ static gx_device_procs sixel_procs = # define BOTTOM_MARGIN 0.4 #endif gx_device_printer gs_ln03_device = - prn_device(sixel_procs, "ln03", + prn_device(sixel_initialize_device_procs, "ln03", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 300, 300, /* x_dpi, y_dpi */ 0, BOTTOM_MARGIN, 0, 0, /* left, bottom, right, top margin */ @@ -96,7 +102,7 @@ ln03_print_page(gx_device_printer *pdev, gp_file *prn_stream) */ static dev_proc_print_page(dl2100_print_page); gx_device_printer gs_dl2100_device = - prn_device(sixel_procs, "dl2100", + prn_device(sixel_initialize_device_procs, "dl2100", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 300, 300, /* x_dpi, y_dpi */ 0, 0, 0, 0, /* left, bottom, right, top margin */ @@ -121,7 +127,7 @@ dl2100_print_page(gx_device_printer *pdev, gp_file *prn_stream) */ static dev_proc_print_page(la50_print_page); gx_device_printer gs_la50_device = - prn_device(sixel_procs, "la50", + prn_device(sixel_initialize_device_procs, "la50", 85, 110, 144, 72, @@ -148,7 +154,7 @@ la50_print_page(gx_device_printer *pdev, gp_file *prn_stream) */ static dev_proc_print_page(la70_print_page); gx_device_printer gs_la70_device = - prn_device(sixel_procs, "la70", + prn_device(sixel_initialize_device_procs, "la70", 85, 110, 144, 144, @@ -174,7 +180,7 @@ la70_print_page(gx_device_printer *pdev, gp_file *prn_stream) */ static dev_proc_print_page(la75_print_page); gx_device_printer gs_la75_device = - prn_device(sixel_procs, "la75", + prn_device(sixel_initialize_device_procs, "la75", 85, 110, 144, 72, @@ -201,7 +207,7 @@ la75_print_page(gx_device_printer *pdev, gp_file *prn_stream) */ static dev_proc_print_page(la75plus_print_page); gx_device_printer gs_la75plus_device = - prn_device(sixel_procs, "la75plus", + prn_device(sixel_initialize_device_procs, "la75plus", 85, 110, 180, 180, @@ -235,7 +241,7 @@ la75plus_print_page(gx_device_printer *pdev, gp_file *prn_stream) */ static dev_proc_print_page(sxlcrt_print_page); gx_device_printer gs_sxlcrt_device = - prn_device(sixel_procs, + prn_device(sixel_initialize_device_procs, "sxlcrt", 180, 110, diff --git a/contrib/gdevlx32.c b/contrib/gdevlx32.c index 7cbd2b97..4471e1a0 100644 --- a/contrib/gdevlx32.c +++ b/contrib/gdevlx32.c @@ -257,10 +257,20 @@ static int print_photo_page(pagedata *gendata); */ /* Device procedures */ -static gx_device_procs lxm3200_procs = - prn_color_params_procs(lxm3200_open, gdev_prn_output_page, gdev_prn_close, - lxm3200_map_rgb_color, lxm3200_map_color_rgb, lxm3200_get_params, - lxm3200_put_params); +static void +lxm3200_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, lxm3200_open); + set_dev_proc(dev, map_rgb_color, lxm3200_map_rgb_color); + set_dev_proc(dev, map_color_rgb, lxm3200_map_color_rgb); + set_dev_proc(dev, get_params, lxm3200_get_params); + set_dev_proc(dev, put_params, lxm3200_put_params); + set_dev_proc(dev, map_cmyk_color, gx_error_encode_color); + set_dev_proc(dev, encode_color, lxm3200_map_rgb_color); + set_dev_proc(dev, decode_color, lxm3200_map_color_rgb); +} /* Define an extension (subclass) of gx_device_printer. */ struct lxm_device_s @@ -308,7 +318,7 @@ struct lxm_device_s lxm_device far_data gs_lxm3200_device = { prn_device_body(lxm_device, - lxm3200_procs, + lxm3200_initialize_device_procs, "lxm3200", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, diff --git a/contrib/gdevlx7.c b/contrib/gdevlx7.c index 37f9697f..d4fb44a5 100644 --- a/contrib/gdevlx7.c +++ b/contrib/gdevlx7.c @@ -107,9 +107,14 @@ static dev_proc_get_params(lxm_get_params); static dev_proc_put_params(lxm_put_params); /* set up dispatch table. I follow gdevdjet in using gdev_prn_output_page */ -static const gx_device_procs lxm7000m_procs = - prn_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close, - lxm_get_params, lxm_put_params); +static void +lxm7000m_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, get_params, lxm_get_params); + set_dev_proc(dev, put_params, lxm_put_params); +} /* The device descriptors */ @@ -140,7 +145,7 @@ typedef struct lxm_device_s { /* a sub-class of gx_device_printer */ #define LXR_1200 2 lxm_device far_data gs_lex7000_device = { - prn_device_std_body(lxm_device, lxm7000m_procs, "lex7000", + prn_device_std_body(lxm_device, lxm7000m_initialize_device_procs, "lex7000", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* total width & height in 10x " - A4 or letter compiled in. * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter @@ -163,7 +168,7 @@ lxm_device far_data gs_lex7000_device = { }; lxm_device far_data gs_lex5700_device = { - prn_device_std_body(lxm_device, lxm7000m_procs, "lex5700", + prn_device_std_body(lxm_device, lxm7000m_initialize_device_procs, "lex5700", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* total width & height in 10x " - A4 or letter compiled in. * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter @@ -186,7 +191,7 @@ lxm_device far_data gs_lex5700_device = { }; lxm_device far_data gs_lex3200_device = { - prn_device_std_body(lxm_device, lxm7000m_procs, "lex3200", + prn_device_std_body(lxm_device, lxm7000m_initialize_device_procs, "lex3200", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* total width & height in 10x " - A4 or letter compiled in. * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter @@ -209,7 +214,7 @@ lxm_device far_data gs_lex3200_device = { }; lxm_device far_data gs_lex2050_device = { - prn_device_std_body(lxm_device, lxm7000m_procs, "lex2050", + prn_device_std_body(lxm_device, lxm7000m_initialize_device_procs, "lex2050", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* total width & height in 10x " - A4 or letter compiled in. * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter diff --git a/contrib/gdevmd2k.c b/contrib/gdevmd2k.c index 86202774..826846f9 100644 --- a/contrib/gdevmd2k.c +++ b/contrib/gdevmd2k.c @@ -64,32 +64,27 @@ typedef struct gx_device_alps_s gx_device_alps; #define dev_alps ((gx_device_alps *) pdev) -static gx_device_procs alps_procs = { - alps_open, - gx_default_get_initial_matrix, - NULL, /* sync_output */ - gdev_prn_output_page, - gdev_prn_close, - NULL, /* map_rgb_color,*/ - alps_map_color_rgb, - NULL, /* fill_rectangle */ - NULL, /* tile_rectangle */ - NULL, /* copy_mono */ - NULL, /* copy_color */ - NULL, /* draw_line */ - NULL, /* get_bits */ - alps_get_params, - alps_put_params, - alps_map_cmyk_color, - NULL, /* get_xfont_procs */ - NULL, /* get_xfont_device */ - NULL, /* map_rgb_alpha_color */ - gx_page_device_get_page_device /* get_page_device */ -}; +static void +alps_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, alps_open); + set_dev_proc(dev, map_color_rgb, alps_map_color_rgb); + set_dev_proc(dev, get_params, alps_get_params); + set_dev_proc(dev, put_params, alps_put_params); + set_dev_proc(dev, map_cmyk_color, alps_map_cmyk_color); + + /* The static init used in previous versions of the code leave + * encode_color and decode_color set to NULL (which are then rewritten + * by the system to the default. For compatibility we do the same. */ + set_dev_proc(dev, encode_color, NULL); + set_dev_proc(dev, decode_color, NULL); +} #define alps_device(dname, print_page) \ {\ - prn_device_body(gx_device_alps, alps_procs, dname,\ + prn_device_body(gx_device_alps, alps_initialize_device_procs, dname,\ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,\ 600, 600,\ 0, 0, 0, 0, /* margin */\ diff --git a/contrib/gdevop4w.c b/contrib/gdevop4w.c index a92f6e63..4d5a38f5 100644 --- a/contrib/gdevop4w.c +++ b/contrib/gdevop4w.c @@ -94,12 +94,17 @@ static dev_proc_open_device(oki4w_open); static dev_proc_close_device(oki4w_close); static dev_proc_print_page(oki4w_print_page); -static gx_device_procs prn_hp_procs = - prn_params_procs(oki4w_open, gdev_prn_output_page, oki4w_close, - gdev_prn_get_params, gdev_prn_put_params); +static void +oki4w_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, oki4w_open); + set_dev_proc(dev, close_device, oki4w_close); +} gx_device_printer far_data gs_oki4w_device = - prn_device(prn_hp_procs, "oki4w", + prn_device(oki4w_initialize_device_procs, "oki4w", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI, 0, 0, 0, 0, /* margins filled in by oki4w_open */ diff --git a/contrib/gdevxes.c b/contrib/gdevxes.c index a10b89c8..0f2db969 100644 --- a/contrib/gdevxes.c +++ b/contrib/gdevxes.c @@ -48,8 +48,15 @@ static int sixel_print_page(gx_device_printer *pdev, /* The device descriptor */ static dev_proc_output_page(sixel_output_page); static dev_proc_print_page(xes_print_page); -static gx_device_procs xes_procs = - prn_procs(gdev_prn_open, sixel_output_page, gdev_prn_close); + +static void +sixel_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, output_page, sixel_output_page); +} + #ifdef A4 # define BOTTOM_MARGIN 0.5 @@ -60,7 +67,7 @@ static gx_device_procs xes_procs = #endif gx_device_printer gs_xes_device = - prn_device(xes_procs, "xes", + prn_device(sixel_initialize_device_procs, "xes", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 300, 300, /* x_dpi, y_dpi */ 0, BOTTOM_MARGIN, 0, 0, /* left, bottom, right, top margin */ diff --git a/contrib/japanese/gdev10v.c b/contrib/japanese/gdev10v.c index f4c349d1..0bd3cec0 100644 --- a/contrib/japanese/gdev10v.c +++ b/contrib/japanese/gdev10v.c @@ -37,36 +37,8 @@ copies. */ No checking on resolutions are being made. */ -#if 0 -#define prn_matrix_procs(p_open, p_get_initial_matrix, p_output_page, p_close) {\ - p_open,\ - p_get_initial_matrix,\ - NULL, /* sync_output */\ - p_output_page,\ - p_close,\ - gdev_prn_map_rgb_color,\ - gdev_prn_map_color_rgb,\ - NULL, /* fill_rectangle */\ - NULL, /* tile_rectangle */\ - NULL, /* copy_mono */\ - NULL, /* copy_color */\ - NULL, /* draw_line */\ - NULL, /* get_bits */\ - gdev_prn_get_params,\ - gdev_prn_put_params,\ - NULL, /* map_cmyk_color */\ - NULL, /* get_xfont_procs */\ - NULL, /* get_xfont_device */\ - NULL, /* map_rgb_alpha_color */\ - gx_page_device_get_page_device\ -} -#endif - /* The device descriptor */ static dev_proc_print_page(bj10v_print_page); -#if 0 -static dev_proc_get_initial_matrix(bj10v_get_initial_matrix); -#endif static int bj10v_open(gx_device * pdev) @@ -82,15 +54,37 @@ bj10v_open(gx_device * 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); +/* Shift the origin from the top left corner of the pysical page to the + first printable pixel, as defined by the top and left margins. */ +static void +bj10v_get_initial_matrix(gx_device *dev, gs_matrix *pmat) +{ gx_default_get_initial_matrix(dev, pmat); + pmat->tx -= dev_l_margin(dev) * dev->x_pixels_per_inch; + pmat->ty -= dev_t_margin(dev) * dev->y_pixels_per_inch; +} + +static void +bj10v_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, get_initial_matrix, bj10v_get_initial_matrix); +} + +#else + +static void +bj10v_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, bj10v_open); +} + #endif -gx_device_procs prn_bj10v_procs = - prn_procs(bj10v_open, gdev_prn_output_page, gdev_prn_close); gx_device_printer gs_bj10v_device = - prn_device(prn_bj10v_procs, "bj10v", + prn_device(bj10v_initialize_device_procs, "bj10v", DEFAULT_WIDTH_10THS, /* width_10ths */ DEFAULT_HEIGHT_10THS, /* height_10ths */ 360, /* x_dpi */ @@ -99,7 +93,7 @@ gx_device_printer gs_bj10v_device = 1, bj10v_print_page); gx_device_printer gs_bj10vh_device = - prn_device(prn_bj10v_procs, "bj10vh", + prn_device(bj10v_initialize_device_procs, "bj10vh", DEFAULT_WIDTH_10THS, /* width_10ths */ DEFAULT_HEIGHT_10THS, /* height_10ths */ 360, /* x_dpi */ @@ -107,19 +101,6 @@ gx_device_printer gs_bj10vh_device = 0.134, 0.507, 0.166, 0.335, /* l, b, r, t margins */ 1, bj10v_print_page); -/* ------ Internal routines ------ */ - -#if 0 -/* Shift the origin from the top left corner of the pysical page to the - first printable pixel, as defined by the top and left margins. */ -static void -bj10v_get_initial_matrix(gx_device *dev, gs_matrix *pmat) -{ gx_default_get_initial_matrix(dev, pmat); - pmat->tx -= dev_l_margin(dev) * dev->x_pixels_per_inch; - pmat->ty -= dev_t_margin(dev) * dev->y_pixels_per_inch; -} -#endif - /* ---- Printer output routines ---- */ /* Note: Following code is stolen from gdevp201.c. On NEC PC9801 series, diff --git a/contrib/japanese/gdevalps.c b/contrib/japanese/gdevalps.c index 9d3122ac..c04f69ef 100644 --- a/contrib/japanese/gdevalps.c +++ b/contrib/japanese/gdevalps.c @@ -57,11 +57,16 @@ static dev_proc_print_page(md50m_print_page); static dev_proc_print_page(md50e_print_page); static dev_proc_print_page(md1xm_print_page); -static gx_device_procs prn_md_procs = - prn_procs(md_open, gdev_prn_output_page, gdev_prn_close); +static void +md_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, md_open); +} gx_device_printer far_data gs_md50Mono_device = - prn_device(prn_md_procs, "md50Mono", + prn_device(md_initialize_device_procs, "md50Mono", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 600, /* x_dpi */ @@ -70,7 +75,7 @@ gx_device_printer far_data gs_md50Mono_device = 1, md50m_print_page); gx_device_printer far_data gs_md50Eco_device = - prn_device(prn_md_procs, "md50Eco", + prn_device(md_initialize_device_procs, "md50Eco", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 600, /* x_dpi */ @@ -79,7 +84,7 @@ gx_device_printer far_data gs_md50Eco_device = 1, md50e_print_page); gx_device_printer far_data gs_md1xMono_device = - prn_device(prn_md_procs, "md1xMono", + prn_device(md_initialize_device_procs, "md1xMono", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 600, /* x_dpi */ diff --git a/contrib/japanese/gdevespg.c b/contrib/japanese/gdevespg.c index 2f182134..4ce7b718 100644 --- a/contrib/japanese/gdevespg.c +++ b/contrib/japanese/gdevespg.c @@ -42,19 +42,34 @@ static dev_proc_image_out(escpage_image_out); static void escpage_printer_initialize(gx_device_printer * pdev, gp_file * fp, int); static void escpage_paper_set(gx_device_printer * pdev, gp_file * fp); -static gx_device_procs lp2000_prn_procs = -lprn_procs(lp2000_open, gdev_prn_output_page, gdev_prn_close); +static void +lp2000_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, lp2000_open); + set_dev_proc(dev, get_params, lprn_get_params); + set_dev_proc(dev, put_params, lprn_put_params); +} -static gx_device_procs escpage_prn_procs = -lprn_procs(escpage_open, gdev_prn_output_page, escpage_close); +static void +escpage_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, escpage_open); + set_dev_proc(dev, close_device, escpage_close); + set_dev_proc(dev, get_params, lprn_get_params); + set_dev_proc(dev, put_params, lprn_put_params); +} gx_device_lprn far_data gs_lp2000_device = -lprn_device(gx_device_lprn, lp2000_prn_procs, "lp2000", +lprn_device(gx_device_lprn, lp2000_initialize_device_procs, "lp2000", DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1, lp2000_print_page_copies, escpage_image_out); gx_device_lprn far_data gs_escpage_device = -lprn_duplex_device(gx_device_lprn, escpage_prn_procs, "escpage", +lprn_duplex_device(gx_device_lprn, escpage_initialize_device_procs, "escpage", DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1, escpage_print_page_copies, escpage_image_out); diff --git a/contrib/japanese/gdevfmlbp.c b/contrib/japanese/gdevfmlbp.c index 0e0ab425..2de50e40 100644 --- a/contrib/japanese/gdevfmlbp.c +++ b/contrib/japanese/gdevfmlbp.c @@ -41,15 +41,16 @@ copies. */ /* The device descriptors */ static dev_proc_print_page(fmlbp_print_page); -#ifdef FMLBP_NOADJUST_MARGIN -#define PRNFMLBP prn_std_procs +static void fmlbp_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); +} + +#ifdef FMLBP_NOADJUST_MARGIN +#define PRNFML_INIT fmlbp_initialize_device_procs #else /* Adjust margin for ghostscript 2.6.1 */ -#define PRNFMLBP prn_fmlbp_procs -static dev_proc_get_initial_matrix(fmlbp_get_initial_matrix); -gx_device_procs prn_fmlbp_procs = - prn_matrix_procs(gdev_prn_open, fmlbp_get_initial_matrix, - gdev_prn_output_page, gdev_prn_close); +#define PRNFML_INIT fmlbp_initialize_device_procs_with_matrix /* Shift the origin from the top left corner of the pysical page to the first printable pixel, as defined by the top and left margins. */ @@ -60,10 +61,17 @@ fmlbp_get_initial_matrix(gx_device *dev, gs_matrix *pmat) pmat->tx -= (dev->l_margin * dev->x_pixels_per_inch); pmat->ty -= (dev->t_margin * dev->y_pixels_per_inch); } + +static void fmlbp_initialize_device_procs_with_matrix(gx_device *dev) +{ + fmlbp_initialize_device_procs(dev); + + set_dev_proc(dev, get_initial_matrix, fmlbp_get_initial_matrix); +} #endif/*FMLBP_NOADJUST_MARGIN*/ gx_device_printer gs_fmlbp_device = - prn_device(PRNFMLBP, "fmlbp", + prn_device(PRNFML_INIT, "fmlbp", DEFAULT_WIDTH_10THS_A4, /* width_10ths, 8.3" */ DEFAULT_HEIGHT_10THS_A4, /* height_10ths, 11.7" */ X_DPI, Y_DPI, diff --git a/contrib/japanese/gdevfmpr.c b/contrib/japanese/gdevfmpr.c index cd34d4fd..3e4aaefd 100644 --- a/contrib/japanese/gdevfmpr.c +++ b/contrib/japanese/gdevfmpr.c @@ -30,7 +30,7 @@ static dev_proc_print_page(fmpr_print_page); /* The device descriptor */ gx_device_printer gs_fmpr_device = - prn_device(prn_std_procs, "fmpr", + prn_device(gdev_prn_initialize_device_procs_mono, "fmpr", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 180, /* x_dpi */ diff --git a/contrib/japanese/gdevj100.c b/contrib/japanese/gdevj100.c index f8a70179..8305e1c4 100644 --- a/contrib/japanese/gdevj100.c +++ b/contrib/japanese/gdevj100.c @@ -29,7 +29,7 @@ static dev_proc_print_page(jj100_print_page); /* The device descriptor */ gx_device_printer gs_jj100_device = - prn_device(prn_std_procs, "jj100", + prn_device(gdev_prn_initialize_device_procs_mono, "jj100", 82, /* width_10ths, 8.2" = 210mm(A4) */ 115 /*113, 117*/, /* height_10ths, 11.7" = 297mm(A4) */ 360, /* x_dpi */ diff --git a/contrib/japanese/gdevlbp3.c b/contrib/japanese/gdevlbp3.c index 8cbc2ce8..8042d4db 100644 --- a/contrib/japanese/gdevlbp3.c +++ b/contrib/japanese/gdevlbp3.c @@ -15,7 +15,7 @@ static dev_proc_print_page(lbp310PrintPage); static dev_proc_print_page(lbp320PrintPage); gx_device_printer far_data gs_lbp310_device = - prn_device(prn_std_procs, + prn_device(gdev_prn_initialize_device_procs_mono, "lbp310", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, @@ -27,7 +27,7 @@ gx_device_printer far_data gs_lbp310_device = 1, lbp310PrintPage); gx_device_printer far_data gs_lbp320_device = - prn_device(prn_std_procs, + prn_device(gdev_prn_initialize_device_procs_mono, "lbp320", DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, diff --git a/contrib/japanese/gdevmjc.c b/contrib/japanese/gdevmjc.c index b132167d..591f75fd 100644 --- a/contrib/japanese/gdevmjc.c +++ b/contrib/japanese/gdevmjc.c @@ -208,89 +208,74 @@ typedef struct gx_device_mj_s gx_device_mj; (bpp == 32 ? 3 : 1), dns, r, g, b, k, drct, mcrwv, dtsz \ } -#define mj_colour_procs(proc_colour_open, proc_get_params, proc_put_params)\ -{ proc_colour_open,\ - gx_default_get_initial_matrix,\ - gx_default_sync_output,\ - gdev_prn_output_page,\ - gdev_prn_close,\ - gdev_mjc_map_rgb_color,\ - gdev_mjc_map_color_rgb,\ - NULL, /* fill_rectangle */\ - NULL, /* tile_rectangle */\ - NULL, /* copy_mono */\ - NULL, /* copy_color */\ - NULL, /* draw_line */\ - gx_default_get_bits,\ - proc_get_params,\ - proc_put_params,\ - NULL, /* map_cmyk_color */\ - NULL, /* get_xfont_procs */\ - NULL, /* get_xfont_device */\ - NULL, /* map_rgb_alpha_color */\ - NULL, /* get_page_device */\ - NULL, /* get_alpha_bits */\ - NULL, /* copy_alpha */\ - NULL, /* get_band */\ - NULL, /* copy_rop */\ - NULL, /* fill_path */\ - NULL, /* stroke_path */\ - NULL, /* fill_mask */\ - NULL, /* fill_trapezoid */\ - NULL, /* fill_parallelogram */\ - NULL, /* fill_triangle */\ - NULL, /* draw_thin_line */\ - NULL, /* begin_image */\ - NULL, /* image_data */\ - NULL, /* end_image */\ - NULL, /* strip_tile_rectangle */\ - NULL, /* strip_copy_rop, */\ - NULL, /* get_clipping_box */\ - NULL, /* begin_typed_image */\ - NULL, /* get_bits_rectangle */\ - NULL, /* map_color_rgb_alpha */\ - NULL, /* create_compositor */\ - NULL, /* get_hardware_params */\ - NULL, /* text_begin */\ - NULL, /* finish_copydevice */\ - NULL, /* begin_transparency_group */\ - NULL, /* end_transparency_group */\ - NULL, /* begin_transparency_mask */\ - NULL, /* end_transparency_mask */\ - NULL, /* discard_transparency_layer */\ - NULL, /* get_color_mapping_procs */\ - NULL, /* get_color_comp_index */\ - gdev_mjc_encode_color,\ - gdev_mjc_decode_color\ +static void +mj_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, map_rgb_color, gdev_mjc_map_rgb_color); + set_dev_proc(dev, map_color_rgb, gdev_mjc_map_color_rgb); + set_dev_proc(dev, get_params, mj_get_params); + set_dev_proc(dev, encode_color, gdev_mjc_encode_color); + set_dev_proc(dev, decode_color, gdev_mjc_decode_color); } -static gx_device_procs mj700v2c_procs = -mj_colour_procs(mj700v2c_open, mj_get_params, mj700v2c_put_params); +static void +mj700v2c_initialize_device_procs(gx_device *dev) +{ + mj_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, mj700v2c_open); + set_dev_proc(dev, put_params, mj700v2c_put_params); +} -static gx_device_procs mj500c_procs = -mj_colour_procs(mj500c_open, mj_get_params, mj500c_put_params); +static void +mj500c_initialize_device_procs(gx_device *dev) +{ + mj_initialize_device_procs(dev); -static gx_device_procs mj6000c_procs = -mj_colour_procs(mj6000c_open, mj_get_params, mj700v2c_put_params); + set_dev_proc(dev, open_device, mj500c_open); + set_dev_proc(dev, put_params, mj500c_put_params); +} -static gx_device_procs mj8000c_procs = -mj_colour_procs(mj8000c_open, mj_get_params, mj700v2c_put_params); +static void +mj6000c_initialize_device_procs(gx_device *dev) +{ + mj_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, mj6000c_open); + set_dev_proc(dev, put_params, mj700v2c_put_params); +} + +static void +mj8000c_initialize_device_procs(gx_device *dev) +{ + mj_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, mj8000c_open); + set_dev_proc(dev, put_params, mj700v2c_put_params); +} gx_device_mj far_data gs_mj700v2c_device = -mjcmyk_device(mj700v2c_procs, "mj700v2c", 360, 360, BITSPERPIXEL, - mj700v2c_print_page, 1024, 1024, 1024, 1024, 1024, 0, 1, 1); +mjcmyk_device(mj700v2c_initialize_device_procs, "mj700v2c", + 360, 360, BITSPERPIXEL, + mj700v2c_print_page, + 1024, 1024, 1024, 1024, 1024, 0, 1, 1); gx_device_mj far_data gs_mj500c_device = -mjcmy_device(mj500c_procs, "mj500c", 360, 360, BITSPERPIXEL, - mj500c_print_page, 1024, 1024, 1024, 1024, 1024, 0, 1, 1); +mjcmy_device(mj500c_initialize_device_procs, "mj500c", + 360, 360, BITSPERPIXEL, + mj500c_print_page, 1024, 1024, 1024, 1024, 1024, 0, 1, 1); gx_device_mj far_data gs_mj6000c_device = -mjcmyk_device(mj6000c_procs, "mj6000c", 360, 360, BITSPERPIXEL, - mj6000c_print_page, 1024, 1024, 1024, 1024, 1024, 0, 1, 1); +mjcmyk_device(mj6000c_initialize_device_procs, "mj6000c", + 360, 360, BITSPERPIXEL, + mj6000c_print_page, 1024, 1024, 1024, 1024, 1024, 0, 1, 1); gx_device_mj far_data gs_mj8000c_device = -mjcmyk_device(mj8000c_procs, "mj8000c", 360, 360, BITSPERPIXEL, - mj8000c_print_page, 1024, 1024, 1024, 1024, 1024, 0, 1, 1); +mjcmyk_device(mj8000c_initialize_device_procs, "mj8000c", + 360, 360, BITSPERPIXEL, + mj8000c_print_page, 1024, 1024, 1024, 1024, 1024, 0, 1, 1); /* Get the paper size code, based on width and height. */ static int diff --git a/contrib/japanese/gdevml6.c b/contrib/japanese/gdevml6.c index d8eaa1c3..9ea1fbb5 100644 --- a/contrib/japanese/gdevml6.c +++ b/contrib/japanese/gdevml6.c @@ -32,11 +32,17 @@ static dev_proc_open_device(ml600_open); static dev_proc_close_device(ml600_close); static dev_proc_print_page(ml600_print_page); -static gx_device_procs ml600_procs = - prn_procs(ml600_open, gdev_prn_output_page, ml600_close); +static void +ml600_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, ml600_open); + set_dev_proc(dev, close_device, ml600_close); +} gx_device_printer gs_ml600_device = - prn_device(ml600_procs, "ml600", + prn_device(ml600_initialize_device_procs, "ml600", 83, /* width_10ths, 8.3" */ 117, /* height_10ths, 11.7" */ 600, 600, diff --git a/contrib/japanese/gdevnpdl.c b/contrib/japanese/gdevnpdl.c index 9deadaee..9c6d6bba 100644 --- a/contrib/japanese/gdevnpdl.c +++ b/contrib/japanese/gdevnpdl.c @@ -118,12 +118,19 @@ static dev_proc_print_page_copies(npdl_print_page_copies); static dev_proc_put_params(npdl_put_params); static dev_proc_image_out(npdl_image_out); -static gx_device_procs npdl_prn_procs = -prn_params_procs(npdl_open, gdev_prn_output_page, npdl_close, - lprn_get_params, npdl_put_params); +static void +npdl_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, npdl_open); + set_dev_proc(dev, close_device, npdl_close); + set_dev_proc(dev, get_params, lprn_get_params); + set_dev_proc(dev, put_params, npdl_put_params); +} gx_device_lprn far_data gs_npdl_device = -lprn_duplex_device(gx_device_lprn, npdl_prn_procs, "npdl", +lprn_duplex_device(gx_device_lprn, npdl_initialize_device_procs, "npdl", X_DPI, Y_DPI, /* default resolution */ 0.0, 0.0, 0.0, 0.0, /* margins */ 1, npdl_print_page_copies, npdl_image_out); diff --git a/contrib/japanese/gdevp201.c b/contrib/japanese/gdevp201.c index 1d3f4607..43fc8b97 100644 --- a/contrib/japanese/gdevp201.c +++ b/contrib/japanese/gdevp201.c @@ -41,7 +41,7 @@ static dev_proc_print_page(pr201_print_page); /* The device descriptor */ gx_device_printer gs_pr201_device = - prn_device(prn_std_procs, "pr201", + prn_device(gdev_prn_initialize_device_procs_mono, "pr201", WIDTH, HEIGHT, 160, @@ -50,7 +50,7 @@ gx_device_printer gs_pr201_device = 1, pr201_print_page); gx_device_printer gs_pr1000_device = - prn_device(prn_std_procs, "pr1000", + prn_device(gdev_prn_initialize_device_procs_mono, "pr1000", WIDTH, HEIGHT, 240, @@ -59,7 +59,7 @@ gx_device_printer gs_pr1000_device = 1, pr201_print_page); gx_device_printer gs_pr150_device = - prn_device(prn_std_procs, "pr150", + prn_device(gdev_prn_initialize_device_procs_mono, "pr150", WIDTH, HEIGHT, 320, @@ -68,7 +68,7 @@ gx_device_printer gs_pr150_device = 1, pr201_print_page); gx_device_printer gs_pr1000_4_device = - prn_device(prn_std_procs, "pr1000_4", + prn_device(gdev_prn_initialize_device_procs, "pr1000_4", WIDTH, HEIGHT, 400, @@ -130,6 +130,7 @@ pr201_print_page(gx_device_printer *pdev, gp_file *prn_stream) int height; int bits_per_column; int bytes_per_column; + int bits_per_column_rounded_up; int chunk_size; byte *in, *out; int lnum, skip; @@ -154,12 +155,17 @@ pr201_print_page(gx_device_printer *pdev, gp_file *prn_stream) height = pdev->height; bits_per_column = head_pins; bytes_per_column = bits_per_column / 8; + bits_per_column_rounded_up = (bits_per_column + 7 ) & ~7; chunk_size = bits_per_column * line_size; in = (byte *) - gs_malloc(pdev->memory->non_gc_memory, bits_per_column, line_size, "pr201_print_page(in)"); + gs_malloc(pdev->memory->non_gc_memory, + bits_per_column_rounded_up, + line_size, "pr201_print_page(in)"); out = (byte *) - gs_malloc(pdev->memory->non_gc_memory, bits_per_column, line_size, "pr201_print_page(out)"); + gs_malloc(pdev->memory->non_gc_memory, + bits_per_column_rounded_up, + line_size, "pr201_print_page(out)"); if(in == 0 || out == 0) return -1; @@ -177,6 +183,14 @@ pr201_print_page(gx_device_printer *pdev, gp_file *prn_stream) gp_fprintf(pdev->file, "\033T%d" , lr_pitch); /* 18/120 inch per line */ + if (bits_per_column_rounded_up != bits_per_column) { + memset(in + bits_per_column * line_size, 0, + (bits_per_column_rounded_up - bits_per_column) * + line_size); + memset(out, 0, + bits_per_column_rounded_up * line_size); + } + /* Send Data to printer */ lnum = 0; skip = 0; diff --git a/contrib/japanese/gdevrpdl.c b/contrib/japanese/gdevrpdl.c index d7e561f5..dbb0249c 100644 --- a/contrib/japanese/gdevrpdl.c +++ b/contrib/japanese/gdevrpdl.c @@ -34,11 +34,19 @@ static dev_proc_image_out(rpdl_image_out); static void rpdl_printer_initialize(gx_device_printer * pdev, gp_file * prn_stream, int num_copies); static void rpdl_paper_set(gx_device_printer * pdev, gp_file * prn_stream); -static gx_device_procs rpdl_prn_procs = -lprn_procs(rpdl_open, gdev_prn_output_page, rpdl_close); +static void +rpdl_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, rpdl_open); + set_dev_proc(dev, close_device, rpdl_close); + set_dev_proc(dev, get_params, lprn_get_params); + set_dev_proc(dev, put_params, lprn_put_params); +} gx_device_lprn far_data gs_rpdl_device = -lprn_device(gx_device_lprn, rpdl_prn_procs, "rpdl", +lprn_device(gx_device_lprn, rpdl_initialize_device_procs, "rpdl", DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1, rpdl_print_page_copies, rpdl_image_out); diff --git a/contrib/lips4/gdevl4r.c b/contrib/lips4/gdevl4r.c index d8bcec7e..3b5100c4 100644 --- a/contrib/lips4/gdevl4r.c +++ b/contrib/lips4/gdevl4r.c @@ -99,24 +99,52 @@ struct gx_device_lips4_s { lips4_params_common; }; -static gx_device_procs lips2p_prn_procs = -prn_params_procs(lips2p_open, gdev_prn_output_page, lips_close, - lips_get_params, lips_put_params); +static void +lips2p_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); -static gx_device_procs lips3_prn_procs = -prn_params_procs(lips3_open, gdev_prn_output_page, lips_close, - lips_get_params, lips_put_params); + set_dev_proc(dev, open_device, lips2p_open); + set_dev_proc(dev, close_device, lips_close); + set_dev_proc(dev, get_params, lips_get_params); + set_dev_proc(dev, put_params, lips_put_params); +}; -static gx_device_procs bjc880j_prn_color_procs = -prn_params_procs(bjc880j_open, gdev_prn_output_page, lips_close, - lips4_get_params, lips4_put_params); +static void +lips3_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); -static gx_device_procs lips4_prn_procs = -prn_params_procs(lips4_open, gdev_prn_output_page, lips_close, - lips4_get_params, lips4_put_params); + set_dev_proc(dev, open_device, lips3_open); + set_dev_proc(dev, close_device, lips_close); + set_dev_proc(dev, get_params, lips_get_params); + set_dev_proc(dev, put_params, lips_put_params); +}; + +static void +bjc880j_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, bjc880j_open); + set_dev_proc(dev, close_device, lips_close); + set_dev_proc(dev, get_params, lips4_get_params); + set_dev_proc(dev, put_params, lips4_put_params); +}; + +static void +lips4_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs_mono(dev); + + set_dev_proc(dev, open_device, lips4_open); + set_dev_proc(dev, close_device, lips_close); + set_dev_proc(dev, get_params, lips4_get_params); + set_dev_proc(dev, put_params, lips4_put_params); +}; gx_device_lips far_data gs_lips2p_device = -lips_device(gx_device_lips, lips2p_prn_procs, "lips2p", +lips_device(gx_device_lips, lips2p_initialize_device_procs, "lips2p", LIPS2P_DPI_DEFAULT, LIPS2P_DPI_DEFAULT, LIPS2P_LEFT_MARGIN_DEFAULT, @@ -128,7 +156,7 @@ lips_device(gx_device_lips, lips2p_prn_procs, "lips2p", LIPS_USERNAME_DEFAULT); gx_device_lips far_data gs_lips3_device = -lips_device(gx_device_lips, lips3_prn_procs, "lips3", +lips_device(gx_device_lips, lips3_initialize_device_procs, "lips3", LIPS3_DPI_DEFAULT, LIPS3_DPI_DEFAULT, LIPS3_LEFT_MARGIN_DEFAULT, @@ -140,7 +168,7 @@ lips_device(gx_device_lips, lips3_prn_procs, "lips3", LIPS_USERNAME_DEFAULT); gx_device_lips4 far_data gs_bjc880j_device = -lips4_device(gx_device_lips4, bjc880j_prn_color_procs, "bjc880j", +lips4_device(gx_device_lips4, bjc880j_initialize_device_procs, "bjc880j", BJC880J_DPI_DEFAULT, BJC880J_DPI_DEFAULT, BJC880J_LEFT_MARGIN_DEFAULT, @@ -152,7 +180,7 @@ lips4_device(gx_device_lips4, bjc880j_prn_color_procs, "bjc880j", LIPS_USERNAME_DEFAULT); gx_device_lips4 far_data gs_lips4_device = -lips4_device(gx_device_lips4, lips4_prn_procs, "lips4", +lips4_device(gx_device_lips4, lips4_initialize_device_procs, "lips4", LIPS4_DPI_DEFAULT, LIPS4_DPI_DEFAULT, LIPS4_LEFT_MARGIN_DEFAULT, @@ -179,13 +207,8 @@ static int lips4c_output_page(gx_device_printer * pdev, gp_file * prn_stream); static int lips_delta_encode(byte * inBuff, byte * prevBuff, byte * outBuff, byte * diffBuff, int Length); static int lips_byte_cat(byte * TotalBuff, byte * Buff, int TotalLen, int Len); static int lips_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream, lips_printer_type ptype, int numcopies); -#if GS_VERSION_MAJOR >= 8 static int lips_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream, lips_printer_type ptype, int numcopies); static int lips4type_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream, int num_copies, int ptype); -#else -static int lips_print_page_copies(P4(gx_device_printer * pdev, gp_file * prn_stream, lips_printer_type ptype, int numcopies)); -static int lips_print_page_copies(P4(gx_device_printer * pdev, gp_file * prn_stream, lips_printer_type ptype, int numcopies)); -#endif static int lips2p_open(gx_device * pdev) { diff --git a/contrib/lips4/gdevl4v.c b/contrib/lips4/gdevl4v.c index 47b3fd17..1cdc17c4 100644 --- a/contrib/lips4/gdevl4v.c +++ b/contrib/lips4/gdevl4v.c @@ -97,7 +97,7 @@ static dev_proc_copy_color(lips4v_copy_color); static dev_proc_put_params(lips4v_put_params); static dev_proc_get_params(lips4v_get_params); static dev_proc_fill_mask(lips4v_fill_mask); -static dev_proc_begin_image(lips4v_begin_image); +static dev_proc_begin_typed_image(lips4v_begin_typed_image); #define X_DPI 600 #define Y_DPI 600 @@ -145,7 +145,8 @@ gs_public_st_suffix_add0_final(st_device_lips4v, gx_device_lips4v, std_device_part3_() #define lips4v_device_body\ - lips_device_full_body(gx_device_lips4v, 0, "lips4v",\ + lips_device_full_body(gx_device_lips4v,\ + lips4v_initialize_device_procs, "lips4v",\ &st_device_lips4v,\ DEFAULT_WIDTH_10THS * X_DPI / 10,\ DEFAULT_HEIGHT_10THS * Y_DPI / 10,\ @@ -156,48 +157,34 @@ gs_public_st_suffix_add0_final(st_device_lips4v, gx_device_lips4v, LIPS4_RIGHT_MARGIN_DEFAULT,\ LIPS4_TOP_MARGIN_DEFAULT) -#define lips4v_procs\ - { lips4v_open,\ - gx_upright_get_initial_matrix,\ - NULL, /* sync_output */\ - lips4v_output_page,\ - lips4v_close,\ - gx_default_gray_map_rgb_color,\ - gx_default_gray_map_color_rgb,\ - gdev_vector_fill_rectangle,\ - NULL, /* tile_rectangle */\ - lips4v_copy_mono,\ - lips4v_copy_color,\ - NULL, /* draw_line */\ - NULL, /* get_bits */\ - lips4v_get_params,\ - lips4v_put_params,\ - NULL, /* map_cmyk_color */\ - NULL, /* get_xfont_procs */\ - NULL, /* get_xfont_device */\ - NULL, /* map_rgb_alpha_color */\ - gx_page_device_get_page_device,\ - NULL, /* get_alpha_bits */\ - NULL, /* copy_alpha */\ - NULL, /* get_band */\ - NULL, /* copy_rop */\ - gdev_vector_fill_path,\ - gdev_vector_stroke_path,\ - lips4v_fill_mask,\ - gdev_vector_fill_trapezoid,\ - gdev_vector_fill_parallelogram,\ - gdev_vector_fill_triangle,\ - NULL /****** WRONG ******/, /* draw_thin_line */\ - lips4v_begin_image,\ - NULL,\ - NULL,\ - NULL, /* strip_tile_rectangle */\ - NULL/******strip_copy_rop******/\ - } +static void +lips4v_initialize_device_procs(gx_device *dev) +{ + set_dev_proc(dev, open_device, lips4v_open); + set_dev_proc(dev, get_initial_matrix, gx_upright_get_initial_matrix); + set_dev_proc(dev, output_page, lips4v_output_page); + set_dev_proc(dev, close_device, lips4v_close); + set_dev_proc(dev, map_rgb_color, gx_default_gray_map_rgb_color); + set_dev_proc(dev, map_color_rgb, gx_default_gray_map_color_rgb); + set_dev_proc(dev, fill_rectangle, gdev_vector_fill_rectangle); + set_dev_proc(dev, copy_mono, lips4v_copy_mono); + set_dev_proc(dev, copy_color, lips4v_copy_color); + set_dev_proc(dev, get_params, lips4v_get_params); + set_dev_proc(dev, put_params, lips4v_put_params); + set_dev_proc(dev, get_page_device, gx_page_device_get_page_device); + set_dev_proc(dev, fill_path, gdev_vector_fill_path); + set_dev_proc(dev, stroke_path, gdev_vector_stroke_path); + set_dev_proc(dev, fill_mask, lips4v_fill_mask); + set_dev_proc(dev, fill_trapezoid, gdev_vector_fill_trapezoid); + set_dev_proc(dev, fill_parallelogram, gdev_vector_fill_parallelogram); + set_dev_proc(dev, fill_triangle, gdev_vector_fill_triangle); + set_dev_proc(dev, begin_typed_image, lips4v_begin_typed_image); + set_dev_proc(dev, get_bits_rectangle, gx_blank_get_bits_rectangle); +} gx_device_lips4v far_data gs_lips4v_device = { lips4v_device_body, - lips4v_procs, + { 0 }, vector_initial_values, LIPS_CASSETFEED_DEFAULT, LIPS_USERNAME_DEFAULT, @@ -226,7 +213,6 @@ gx_device_lips4v far_data gs_lips4v_device = { }; /* Vector device implementation */ -#if GS_VERSION_MAJOR >= 8 static int lips4v_beginpage(gx_device_vector * vdev); static int lips4v_setfillcolor(gx_device_vector * vdev, const gs_gstate * pgs, const gx_drawing_color * pdc); @@ -258,43 +244,6 @@ lips4v_closepath(gx_device_vector * vdev, double x, double y, double x_start, double y_start, gx_path_type_t type); static int lips4v_endpath(gx_device_vector * vdev, gx_path_type_t type); -#else -static int lips4v_beginpage(P1(gx_device_vector * vdev)); -static int lips4v_setfillcolor(P2(gx_device_vector * vdev, - const gx_drawing_color * pdc)); -static int lips4v_setstrokecolor(P2(gx_device_vector * vdev, - const gx_drawing_color * pdc)); -static int lips4v_setdash(P4(gx_device_vector * vdev, const float *pattern, - uint count, double offset)); -static int lips4v_setflat(P2(gx_device_vector * vdev, double flatness)); -static int -lips4v_setlogop(P3 - - (gx_device_vector * vdev, gs_logical_operation_t lop, - gs_logical_operation_t diff)); -static int - -lips4v_beginpath(P2(gx_device_vector * vdev, gx_path_type_t type)); -static int -lips4v_moveto(P6 - (gx_device_vector * vdev, double x0, double y0, double x, - double y, gx_path_type_t type)); -static int -lips4v_lineto(P6 - (gx_device_vector * vdev, double x0, double y0, double x, - double y, gx_path_type_t type)); -static int -lips4v_curveto(P10 - (gx_device_vector * vdev, double x0, double y0, double x1, - double y1, double x2, double y2, double x3, double y3, - gx_path_type_t type)); -static int -lips4v_closepath(P6 - (gx_device_vector * vdev, double x, double y, double x_start, - double y_start, gx_path_type_t type)); - -static int lips4v_endpath(P2(gx_device_vector * vdev, gx_path_type_t type)); -#endif static int lips4v_setlinewidth(gx_device_vector * vdev, double width); static int lips4v_setlinecap(gx_device_vector * vdev, gs_line_cap cap); static int lips4v_setlinejoin(gx_device_vector * vdev, gs_line_join join); @@ -311,9 +260,7 @@ static const gx_device_vector_procs lips4v_vector_procs = { lips4v_setflat, lips4v_setlogop, /* Other state */ -#if GS_VERSION_MAJOR >= 8 lips4v_can_handle_hl_color, /* can_handle_hl_color (dummy) */ -#endif lips4v_setfillcolor, /* fill & stroke colors are the same */ lips4v_setstrokecolor, /* Paths */ @@ -1070,13 +1017,8 @@ lips4v_setmiterlimit(gx_device_vector * vdev, double limit) return 0; } -#if GS_VERSION_MAJOR >= 8 static int lips4v_setfillcolor(gx_device_vector * vdev, const gs_gstate * pgs, const gx_drawing_color * pdc) -#else -static int -lips4v_setfillcolor(gx_device_vector * vdev, const gx_drawing_color * pdc) -#endif { if (!gx_dc_is_pure(pdc)) @@ -1138,13 +1080,8 @@ lips4v_setfillcolor(gx_device_vector * vdev, const gx_drawing_color * pdc) return 0; } -#if GS_VERSION_MAJOR >= 8 static int lips4v_setstrokecolor(gx_device_vector * vdev, const gs_gstate * pgs, const gx_drawing_color * pdc) -#else -static int -lips4v_setstrokecolor(gx_device_vector * vdev, const gx_drawing_color * pdc) -#endif { if (!gx_dc_is_pure(pdc)) return_error(gs_error_rangecheck); @@ -1280,7 +1217,6 @@ lips4v_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop, return 0; } -#if GS_VERSION_MAJOR >= 8 /*--- added for Ghostscritp 8.15 ---*/ static int lips4v_can_handle_hl_color(gx_device_vector * vdev, const gs_gstate * pgs1, @@ -1288,7 +1224,6 @@ lips4v_can_handle_hl_color(gx_device_vector * vdev, const gs_gstate * pgs1, { return false; /* High level color is not implemented yet. */ } -#endif static int lips4v_beginpath(gx_device_vector * vdev, gx_path_type_t type) @@ -1438,21 +1373,15 @@ lips4v_open(gx_device * dev) /****** WRONG ******/ vdev->vec_procs = &lips4v_vector_procs; -#if GS_VERSION_MAJOR >= 8 - code = gdev_vector_open_file_options(vdev, 512, + code = gdev_vector_open_file_options(vdev, 512, (VECTOR_OPEN_FILE_SEQUENTIAL|VECTOR_OPEN_FILE_BBOX)); -#else - code = gdev_vector_open_file_bbox(vdev, 512, true); -#endif if (code < 0) return code; -#if GS_VERSION_MAJOR >= 8 - if (pdev->bbox_device != NULL) { - if (pdev->bbox_device->memory == NULL) - pdev->bbox_device->memory = gs_memory_stable(dev->memory); - } -#endif + if (pdev->bbox_device != NULL) { + if (pdev->bbox_device->memory == NULL) + pdev->bbox_device->memory = gs_memory_stable(dev->memory); + } gdev_vector_init(vdev); pdev->first_page = true; @@ -1874,11 +1803,7 @@ lips4v_copy_mono(gx_device * dev, const byte * data, gx_drawing_color dcolor; color_set_pure(&dcolor, one); -#if GS_VERSION_MAJOR >= 8 lips4v_setfillcolor(vdev, NULL, &dcolor); -#else - lips4v_setfillcolor(vdev, &dcolor); -#endif if (lips4v_copy_text_char(dev, data, raster, id, x, y, w, h) >= 0) return 0; @@ -1978,13 +1903,8 @@ lips4v_copy_mono(gx_device * dev, const byte * data, } color_set_pure(&color, one); -#if GS_VERSION_MAJOR >= 8 code = gdev_vector_update_fill_color((gx_device_vector *) pdev, NULL, &color); -#else - code = gdev_vector_update_fill_color((gx_device_vector *) pdev, - &color); -#endif } if (code < 0) return 0; @@ -2061,11 +1981,7 @@ lips4v_copy_color(gx_device * dev, /* LIPS IV ではグレースケールも単色イメージ・カラー指定命令に 影響されるので黒色を指定しなければならない。 */ color_set_pure(&dcolor, vdev->black); -#if GS_VERSION_MAJOR >= 8 lips4v_setfillcolor(vdev, NULL, &dcolor); -#else - lips4v_setfillcolor(vdev, &dcolor); -#endif } else { if (pdev->TextMode) { sputc(s, LIPS_CSI); @@ -2131,11 +2047,7 @@ lips4v_fill_mask(gx_device * dev, if (w <= 0 || h <= 0) return 0; if (depth > 1 || -#if GS_VERSION_MAJOR >= 8 gdev_vector_update_fill_color(vdev, NULL, pdcolor) < 0 || -#else - gdev_vector_update_fill_color(vdev, pdcolor) < 0 || -#endif gdev_vector_update_clip_path(vdev, pcpath) < 0 || gdev_vector_update_log_op(vdev, lop) < 0) return gx_default_fill_mask(dev, data, data_x, raster, id, @@ -2179,6 +2091,18 @@ lips4v_fill_mask(gx_device * dev, byte *buf = gs_alloc_bytes(vdev->memory, num_bytes, "lips4v_fill_mask(buf)"); + /* This code seems suspect to me; we allocate a buffer + * rounding each line up to a multiple of 4, and then + * fill it without reference to this rounding. I suspect + * that each line should be padded, rather than all the + * data being crammed at the start, but I can't make that + * change in the absence of any way to test this. I will + * make do by adding the memset here so that any untouched + * bytes are at least consistently set to 0 to avoid + * indeterminisms (and valgrind errors). RJW */ + if (width_bytes * h < num_bytes) { + memset(buf + width_bytes * h, 0, num_bytes - width_bytes * h); + } for (i = 0; i < h; ++i) { memcpy(buf + i * width_bytes, data + (data_x >> 3) + i * raster, width_bytes); @@ -2202,32 +2126,44 @@ static const gx_image_enum_procs_t lips4v_image_enum_procs = { /* Start processing an image. */ static int -lips4v_begin_image(gx_device * dev, - const gs_gstate * pgs, const gs_image_t * pim, - gs_image_format_t format, const gs_int_rect * prect, - const gx_drawing_color * pdcolor, - const gx_clip_path * pcpath, gs_memory_t * mem, - gx_image_enum_common_t ** pinfo) +lips4v_begin_typed_image(gx_device *dev, + const gs_gstate *pgs, + const gs_matrix *pmat, + const gs_image_common_t *pic, + const gs_int_rect *prect, + const gx_drawing_color *pdcolor, + const gx_clip_path *pcpath, + gs_memory_t *mem, + gx_image_enum_common_t **pinfo) { gx_device_vector *const vdev = (gx_device_vector *) dev; gx_device_lips4v *const pdev = (gx_device_lips4v *) dev; - gdev_vector_image_enum_t *pie = - gs_alloc_struct(mem, gdev_vector_image_enum_t, - &st_vector_image_enum, "lips4v_begin_image"); - const gs_color_space *pcs = pim->ColorSpace; + const gs_image_t *pim = (const gs_image_t *)pic; + gdev_vector_image_enum_t *pie; + const gs_color_space *pcs; gs_color_space_index index = 0; int num_components = 1; - bool can_do = prect == 0 && - (pim->format == gs_image_format_chunky || - - pim->format == gs_image_format_component_planar); - + bool can_do; int code; + pie = gs_alloc_struct(mem, gdev_vector_image_enum_t, + &st_vector_image_enum, "lips4v_begin_typed_image"); if (pie == 0) return_error(gs_error_VMerror); pie->memory = mem; - code = gdev_vector_begin_image(vdev, pgs, pim, format, prect, + + /* We can only cope with type 1 images here.*/ + if (pic->type->index != 1) { + *pinfo = (gx_image_enum_common_t *) pie; + goto fallback; + } + + pcs = pim->ColorSpace; + can_do = prect == NULL && + (pim->format == gs_image_format_chunky || + pim->format == gs_image_format_component_planar); + + code = gdev_vector_begin_image(vdev, pgs, pim, pim->format, prect, pdcolor, pcpath, mem, &lips4v_image_enum_procs, pie); if (code < 0) @@ -2266,21 +2202,19 @@ lips4v_begin_image(gx_device * dev, } } } - if (!can_do) - return gx_default_begin_image(dev, pgs, pim, format, prect, - pdcolor, pcpath, mem, - &pie->default_info); + if (!can_do) { +fallback: + return gx_default_begin_typed_image(dev, pgs, pmat, pic, prect, + pdcolor, pcpath, mem, + &pie->default_info); + } else if (index == gs_color_space_index_DeviceGray) { gx_drawing_color dcolor; /* LIPS IV ではグレースケールも単色イメージ・カラー指定命令に 影響されるので黒色を明示的に指定しなければならない。 */ color_set_pure(&dcolor, vdev->black); -#if GS_VERSION_MAJOR >= 8 lips4v_setfillcolor(vdev, NULL, &dcolor); -#else - lips4v_setfillcolor(vdev, &dcolor); -#endif } if (pim->ImageMask || (pim->BitsPerComponent == 1 && num_components == 1)) { if (pim->Decode[0] > pim->Decode[1]) @@ -2305,7 +2239,9 @@ lips4v_begin_image(gx_device * dev, if (code < 0) return code; - gs_matrix_multiply(&imat, &ctm_only(pgs), &imat); + if (pmat == NULL) + pmat = &ctm_only(pgs); + gs_matrix_multiply(&imat, pmat, &imat); /* [xx xy yx yy tx ty] LIPS の座標系に変換を行なう。 @@ -2386,7 +2322,7 @@ lips4v_begin_image(gx_device * dev, if (index == gs_color_space_index_DeviceGray) lputs(s, "0"); else { - if (format == gs_image_format_chunky) /* RGBRGBRGB... */ + if (pim->format == gs_image_format_chunky) /* RGBRGBRGB... */ sputc(s, 0x3a); else /* RRR...GGG...BBB... */ sputc(s, 0x3b); diff --git a/contrib/lips4/gdevlprn.h b/contrib/lips4/gdevlprn.h index 6b9245a7..4c066c5f 100644 --- a/contrib/lips4/gdevlprn.h +++ b/contrib/lips4/gdevlprn.h @@ -31,13 +31,8 @@ #include "gdevprn.h" -#if GS_VERSION_MAJOR >= 8 #define lprn_dev_proc_image_out(proc)\ void proc(gx_device_printer *, gp_file *, int, int, int, int) -#else -#define lprn_dev_proc_image_out(proc)\ - void proc(P6(gx_device_printer *, gp_file *, int, int, int, int)) -#endif #define dev_proc_image_out(proc) lprn_dev_proc_image_out(proc) @@ -119,9 +114,6 @@ lp_duplex_device_body_rest_(print_page_copies, image_out)\ } -#define lprn_procs(p_open, p_output_page, p_close)\ - prn_params_procs(p_open, p_output_page, p_close, lprn_get_params, lprn_put_params) - typedef struct _Bubble { struct _Bubble *next; diff --git a/contrib/opvp/gdevopvp.c b/contrib/opvp/gdevopvp.c index 70475add..844b46cd 100644 --- a/contrib/opvp/gdevopvp.c +++ b/contrib/opvp/gdevopvp.c @@ -170,12 +170,7 @@ static int oprp_open(gx_device *); static void opvp_get_initial_matrix(gx_device *, gs_matrix *); static int opvp_output_page(gx_device *, int, int); static int opvp_close(gx_device *); -#if GS_VERSION_MAJOR >= 8 static gx_color_index opvp_map_rgb_color(gx_device *, const gx_color_value *); /* modified for gs 8.15 */ -#else -static gx_color_index opvp_map_rgb_color(gx_device *, gx_color_value, - gx_color_value, gx_color_value); -#endif static int opvp_map_color_rgb(gx_device *, gx_color_index, gx_color_value *); static int opvp_copy_mono(gx_device *, const byte *, int, int, gx_bitmap_id, int, int, int, int, @@ -221,14 +216,9 @@ static int opvp_setdash(gx_device_vector *, const float *, uint, double); static int opvp_setflat(gx_device_vector *, double); static int opvp_setlogop(gx_device_vector *, gs_logical_operation_t, gs_logical_operation_t); -#if GS_VERSION_MAJOR >= 8 static int opvp_can_handle_hl_color(gx_device_vector *, const gs_gstate *, const gx_drawing_color *); static int opvp_setfillcolor(gx_device_vector *, const gs_gstate *, const gx_drawing_color *); static int opvp_setstrokecolor(gx_device_vector *, const gs_gstate *,const gx_drawing_color *); -#else -static int opvp_setfillcolor(gx_device_vector *, const gx_drawing_color *); -static int opvp_setstrokecolor(gx_device_vector *, const gx_drawing_color *); -#endif static int opvp_vector_dopath(gx_device_vector *, const gx_path *, gx_path_type_t, const gs_matrix *); static int opvp_vector_dorect(gx_device_vector *, fixed, fixed, fixed, fixed, @@ -278,7 +268,7 @@ static dev_proc_get_params(oprp_get_params); static dev_proc_put_params(opvp_put_params); static dev_proc_put_params(oprp_put_params); static dev_proc_fill_rectangle(opvp_fill_rectangle); -static dev_proc_begin_image(opvp_begin_image); +static dev_proc_begin_typed_image(opvp_begin_typed_image); static image_enum_proc_plane_data(opvp_image_plane_data); static image_enum_proc_end_image(opvp_image_end_image); @@ -306,57 +296,35 @@ gs_public_st_suffix_add0_final( NULL /* *docInfo */ /* device procs */ -#define opvp_procs \ -{\ - opvp_open,\ - opvp_get_initial_matrix,\ - NULL, /* sync_output */\ - opvp_output_page,\ - opvp_close,\ - opvp_map_rgb_color,\ - opvp_map_color_rgb,\ - opvp_fill_rectangle, /*gdev_vector_fill_rectangle,*/\ - NULL, /* tile_rectangle OBSOLETE */\ - opvp_copy_mono,\ - opvp_copy_color,\ - NULL, /* draw_line OBSOLETE */\ - NULL, /* get_bits */\ - opvp_get_params,\ - opvp_put_params,\ - NULL, /* map_cmyk_color */\ - NULL, /* get_xfont_procs */\ - NULL, /* get_xfont_device */\ - NULL, /* map_rgb_alpha_color */\ - gx_page_device_get_page_device,\ - NULL, /* get_alpha_bits OBSOLETE */\ - NULL, /* copy_alpha */\ - NULL, /* get_band */\ - NULL, /* copy_rop */\ - opvp_fill_path,\ - opvp_stroke_path,\ - opvp_fill_mask,\ - gdev_vector_fill_trapezoid,\ - gdev_vector_fill_parallelogram,\ - gdev_vector_fill_triangle,\ - NULL, /* draw_thin_line */\ - opvp_begin_image,\ - NULL, /* image_data */\ - NULL, /* end_image */\ - NULL, /* strip_tile_rectangle */\ - NULL, /* strip_copy_rop */\ - NULL, /* get_clipping_box */\ - NULL, /* begin_typed_image */\ - NULL, /* get_bits_rectangle */\ - NULL, /* map_color_rgb_alpha */\ - NULL, /* create_compositor */\ - NULL, /* get_hardware_params */\ - NULL, /* text_begin */\ - NULL, /* finish_copydevice */\ - NULL, /* begin_transparency_group */\ - NULL, /* end_transparency_group */\ - NULL, /* begin_transparency_mask */\ - NULL, /* end_transparency_mask */\ - NULL /* discard_transparency_layer */\ +static void +opvp_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, opvp_open); + set_dev_proc(dev, get_initial_matrix, opvp_get_initial_matrix); + set_dev_proc(dev, output_page, opvp_output_page); + set_dev_proc(dev, close_device, opvp_close); + set_dev_proc(dev, map_rgb_color, opvp_map_rgb_color); + set_dev_proc(dev, map_color_rgb, opvp_map_color_rgb); + set_dev_proc(dev, fill_rectangle, opvp_fill_rectangle); + set_dev_proc(dev, copy_mono, opvp_copy_mono); + set_dev_proc(dev, copy_color, opvp_copy_color); + set_dev_proc(dev, get_params, opvp_get_params); + set_dev_proc(dev, put_params, opvp_put_params); + set_dev_proc(dev, fill_path, opvp_fill_path); + set_dev_proc(dev, stroke_path, opvp_stroke_path); + set_dev_proc(dev, fill_mask, opvp_fill_mask); + set_dev_proc(dev, fill_trapezoid, gdev_vector_fill_trapezoid); + set_dev_proc(dev, fill_parallelogram, gdev_vector_fill_parallelogram); + set_dev_proc(dev, fill_triangle, gdev_vector_fill_triangle); + set_dev_proc(dev, begin_typed_image, opvp_begin_typed_image); + + /* The static init used in previous versions of the code leave + * encode_color and decode_color set to NULL (which are then rewritten + * by the system to the default. For compatibility we do the same. */ + set_dev_proc(dev, encode_color, NULL); + set_dev_proc(dev, decode_color, NULL); } /* vector procs */ @@ -373,9 +341,7 @@ static gx_device_vector_procs opvp_vector_procs = opvp_setflat, opvp_setlogop, /* Other state */ -#if GS_VERSION_MAJOR >= 8 opvp_can_handle_hl_color, /* added for gs 8.15 */ -#endif opvp_setfillcolor, opvp_setstrokecolor, /* Paths */ @@ -393,7 +359,7 @@ const gx_device_opvp gs_opvp_device = { std_device_dci_type_body( gx_device_opvp, - 0, + opvp_initialize_device_procs, "opvp", &st_device_opvp, DEFAULT_WIDTH_10THS_A4 * X_DPI / 10, @@ -406,27 +372,35 @@ const gx_device_opvp gs_opvp_device = 255, 256, 256 - ), - opvp_procs + ) }; /* for inkjet */ -static gx_device_procs prn_oprp_procs = - prn_color_params_procs( - oprp_open, - opvp_output_page, - opvp_close, - opvp_map_rgb_color, - opvp_map_color_rgb, - oprp_get_params, - oprp_put_params - ); +static void +oprp_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, oprp_open); + set_dev_proc(dev, output_page, opvp_output_page); + set_dev_proc(dev, close_device, opvp_close); + set_dev_proc(dev, map_rgb_color, opvp_map_rgb_color); + set_dev_proc(dev, map_color_rgb, opvp_map_color_rgb); + set_dev_proc(dev, get_params, oprp_get_params); + set_dev_proc(dev, put_params, oprp_put_params); + + /* The static init used in previous versions of the code leave + * encode_color and decode_color set to NULL (which are then rewritten + * by the system to the default. For compatibility we do the same. */ + set_dev_proc(dev, encode_color, NULL); + set_dev_proc(dev, decode_color, NULL); +} const gx_device_oprp gs_oprp_device = { prn_device_std_margins_body( gx_device_oprp, - prn_oprp_procs, + oprp_initialize_device_procs, "oprp", DEFAULT_WIDTH_10THS_A4, DEFAULT_HEIGHT_10THS_A4, @@ -1931,11 +1905,9 @@ prepare_open(gx_device *dev) dev->color_info.dither_grays = 256; dev->color_info.dither_colors = 256; } -#if GS_VERSION_MAJOR >= 8 dev->procs.get_color_mapping_procs = NULL; dev->procs.get_color_comp_index = NULL; gx_device_fill_in_procs(dev); -#endif } /* call Closerinter as dummy */ @@ -2050,13 +2022,11 @@ opvp_open(gx_device *dev) } rdev = (gx_device_oprp *)(dev); pdev = (gx_device_opvp *)(dev); -#if GS_VERSION_MAJOR >= 8 if (pdev->bbox_device != NULL) { if (pdev->bbox_device->memory == NULL) { pdev->bbox_device->memory = gs_memory_stable(dev->memory); } } -#endif outputFD = fileno(gp_get_file(pdev->file)); } else { /* open printer device */ @@ -2479,17 +2449,9 @@ opvp_close(gx_device *dev) /* * map rgb color */ -#if GS_VERSION_MAJOR >= 8 static gx_color_index opvp_map_rgb_color(gx_device *dev, const gx_color_value *prgb /* modified for gs 8.15 */) -#else -static gx_color_index -opvp_map_rgb_color(gx_device *dev, - gx_color_value r, - gx_color_value g, - gx_color_value b) -#endif { opvp_cspace_t cs; uint c, m, y, k; @@ -2499,12 +2461,10 @@ opvp_map_rgb_color(gx_device *dev, opvp_result_t r; #endif -#if GS_VERSION_MAJOR >= 8 gx_color_value r, g, b; /* added for gs 8.15 */ r = prgb[0]; g = prgb[1]; b = prgb[2]; -#endif #if ENABLE_SIMPLE_MODE cs = colorSpace; @@ -2565,31 +2525,19 @@ opvp_map_rgb_color(gx_device *dev, ; break; case OPVP_CSPACE_DEVICEGRAY: -#if GS_VERSION_MAJOR >= 8 { gx_color_value rgb[3]; rgb[0] = rgb[1] = rgb[2] = r; return gx_default_gray_map_rgb_color(dev, rgb); } -#else - return gx_default_gray_map_rgb_color(dev, r, g, b); -#endif break; case OPVP_CSPACE_BW : -#if GS_VERSION_MAJOR >= 8 return gx_default_b_w_map_rgb_color(dev, prgb); -#else - return gx_default_b_w_map_rgb_color(dev, r, g, b); -#endif break; case OPVP_CSPACE_STANDARDRGB: case OPVP_CSPACE_DEVICEKRGB: default: -#if GS_VERSION_MAJOR >= 8 return gx_default_rgb_map_rgb_color(dev, prgb); -#else - return gx_default_rgb_map_rgb_color(dev, r, g, b); -#endif break; } } @@ -3584,11 +3532,7 @@ opvp_fill_mask( { if (vector) { int code; -#if GS_VERSION_MAJOR >= 8 /* for gs 8.15 */ code = gdev_vector_update_fill_color((gx_device_vector *)dev, NULL, pdcolor); -#else - code = gdev_vector_update_fill_color((gx_device_vector *)dev, pdcolor); -#endif if (code < 0) return code; code = gdev_vector_update_clip_path((gx_device_vector *)dev, pcpath); if (code < 0) return code; @@ -3604,11 +3548,11 @@ opvp_fill_mask( * begin image */ static int -opvp_begin_image( +opvp_begin_typed_image( gx_device *dev, const gs_gstate *pgs, - const gs_image_t *pim, - gs_image_format_t format, + const gs_matrix *pmat, + const gs_image_common_t *pic, const gs_int_rect *prect, const gx_drawing_color *pdcolor, const gx_clip_path *pcpath, @@ -3616,7 +3560,8 @@ opvp_begin_image( gx_image_enum_common_t **pinfo) { gx_device_vector *vdev =(gx_device_vector *)dev; - gdev_vector_image_enum_t *vinfo; + const gs_image_t *pim = (const gs_image_t *)pic; + gdev_vector_image_enum_t *vinfo = NULL; gs_matrix mtx; opvp_ctm_t ctm; bool draw_image = false; @@ -3628,16 +3573,13 @@ opvp_begin_image( bool can_reverse = false; int p; float mag[2] = {1, 1}; - const gs_color_space *pcs = pim->ColorSpace; + const gs_color_space *pcs; /* check if paths are too complex */ - if (!checkCPath(pcpath)) { - return gx_default_begin_image( - dev, pgs, pim, format, - prect, pdcolor, pcpath, - mem, pinfo); - } + if (pic->type->index != 1 || !checkCPath(pcpath)) + goto fallback; + pcs = pim->ColorSpace; color_index = 0; vinfo = gs_alloc_struct(mem, gdev_vector_image_enum_t, @@ -3646,8 +3588,8 @@ opvp_begin_image( if (vinfo) { memcpy(imageDecode,pim->Decode,sizeof(pim->Decode)); - vinfo->memory =mem; - code = gdev_vector_begin_image(vdev, pgs, pim, format, prect, + vinfo->memory = mem; + code = gdev_vector_begin_image(vdev, pgs, pim, pim->format, prect, pdcolor, pcpath, mem, &opvp_image_enum_procs, vinfo); @@ -3665,14 +3607,10 @@ opvp_begin_image( if (color_index == gs_color_space_index_Indexed) { base_color_index = gs_color_space_indexed_base_space(pcs)->type->index; - if (((pcs->params.indexed.hival + 1) > 256) - || (bits_per_pixel != 8 && bits_per_pixel != 1)) { - return gx_default_begin_image( - dev, pgs, pim, format, - prect, pdcolor, pcpath, - mem, pinfo); - } else if (base_color_index - == gs_color_space_index_DeviceCMYK) { + if (((pcs->params.indexed.hival + 1) > 256) || + (bits_per_pixel != 8 && bits_per_pixel != 1)) + goto fallback; + if (base_color_index == gs_color_space_index_DeviceCMYK) { /* for CMYK indexed color */ int count; const unsigned char *p @@ -3687,37 +3625,32 @@ opvp_begin_image( byte2frac((*(p + 1 + (count * 4)))), byte2frac((*(p + 2 + (count * 4)))), byte2frac((*(p + 3 + (count * 4)))), -#if GS_VERSION_MAJOR >= 9 pgs, rgb, mem); -#else - pgs, rgb); -#endif *(palette + 0 + (count * 3)) = frac2byte(rgb[0]); *(palette + 1 + (count * 3)) = frac2byte(rgb[1]); *(palette + 2 + (count * 3)) = frac2byte(rgb[2]); } bits_per_pixel = 24; - } else if (base_color_index - == gs_color_space_index_DeviceRGB || - base_color_index == gs_color_space_index_CIEABC) { + } else if (base_color_index == + gs_color_space_index_DeviceRGB || + base_color_index == + gs_color_space_index_CIEABC) { /* for RGB or CalRGB indexed color */ memcpy(palette, pcs->params.indexed.lookup.table.data,\ pcs->params.indexed.lookup.table.size); bits_per_pixel = 24; - } else if (base_color_index - == gs_color_space_index_DeviceGray || - base_color_index == gs_color_space_index_CIEA) { + } else if (base_color_index == + gs_color_space_index_DeviceGray || + base_color_index == + gs_color_space_index_CIEA) { /* for Gray or CalGray indexed color */ memcpy(palette, pcs->params.indexed.lookup.table.data,\ pcs->params.indexed.lookup.table.size); bits_per_pixel = 8; } else { /* except CMYK and RGB */ - return gx_default_begin_image( - dev, pgs, pim, format, - prect, pdcolor, pcpath, - mem, pinfo); + goto fallback; } } } @@ -3730,7 +3663,9 @@ opvp_begin_image( /* adjust matrix */ reverse_image = false; ecode = gs_matrix_invert(&pim->ImageMatrix, &mtx); - gs_matrix_multiply(&mtx, &ctm_only(pgs), &mtx); + if (pmat == NULL) + pmat = &ctm_only(pgs); + gs_matrix_multiply(&mtx, pmat, &mtx); switch (FastImageMode) { case FastImageNoCTM: if ((mtx.xy==0)&&(mtx.yx==0)&& (mtx.yy>=0)) { @@ -3963,8 +3898,7 @@ fallthrough: if(apiEntry->opvpResetCTM) { apiEntry->opvpResetCTM(printerContext); /* reset CTM */ } - return gx_default_begin_image(dev, pgs, pim, format, - prect, pdcolor, pcpath, mem, pinfo); + goto fallback; } } @@ -3975,8 +3909,10 @@ fallthrough: return ecode; } - return gx_default_begin_image(dev, pgs, pim, format, prect, - pdcolor, pcpath, mem, pinfo); +fallback: + gs_free_object(mem, vinfo, "opvp_end_image"); + return gx_default_begin_typed_image(dev, pgs, pmat, pic, prect, + pdcolor, pcpath, mem, pinfo); } /* @@ -4344,7 +4280,6 @@ opvp_image_plane_data( } } } -#if GS_VERSION_MAJOR >= 8 if (vinfo->bits_per_pixel == 24) { /* 24bit RGB color */ for (i = 0; i < height; i++) { ptr = buf + raster_length * i; @@ -4362,25 +4297,6 @@ opvp_image_plane_data( } } } -#else - if (vinfo->bits_per_pixel == 24) { /* 24bit RGB color */ - for (i = 0; i < height; i++) { - ptr = buf + raster_length * i; - for (j = 0; j < vinfo->width; j++) { - ptr[j*3+0] = frac2byte(gx_map_color_frac(pgs, byte2frac(ptr[j*3+0]), effective_transfer.colored.red)); - ptr[j*3+1] = frac2byte(gx_map_color_frac(pgs, byte2frac(ptr[j*3+1]), effective_transfer.colored.green)); - ptr[j*3+2] = frac2byte(gx_map_color_frac(pgs, byte2frac(ptr[j*3+2]), effective_transfer.colored.blue)); - } - } - } else if (vinfo->bits_per_pixel == 8) { /* 8bit Gray image */ - for (i = 0; i < height; i++) { - ptr = buf + raster_length * i; - for (j = 0; j < vinfo->width; j++) { - ptr[j] = frac2byte(gx_map_color_frac(pgs, byte2frac(ptr[j]), effective_transfer.colored.gray)); - } - } - } -#endif /* call TansferDrawImage */ if (apiEntry->opvpTransferDrawImage) { @@ -4721,29 +4637,22 @@ opvp_setlogop( return 0; } -#if GS_VERSION_MAJOR >= 8 -/*--- added for Ghostscritp 8.15 ---*/ +/*--- added for Ghostscript 8.15 ---*/ static int opvp_can_handle_hl_color(gx_device_vector * vdev, const gs_gstate * pgs1, const gx_drawing_color * pdc) { return false; /* High level color is not implemented yet. */ } -#endif /* * set fill color */ -#if GS_VERSION_MAJOR >= 8 static int opvp_setfillcolor( gx_device_vector *vdev, const gs_gstate *pgs, /* added for gs 8.15 */ const gx_drawing_color *pdc) -#else -static int -opvp_setfillcolor(gx_device_vector *vdev, const gx_drawing_color *pdc) -#endif { gx_device_opvp *pdev = (gx_device_opvp *)vdev; opvp_result_t r = -1; @@ -4775,16 +4684,11 @@ opvp_setfillcolor(gx_device_vector *vdev, const gx_drawing_color *pdc) /* * set stroke color */ -#if GS_VERSION_MAJOR >= 8 static int opvp_setstrokecolor( gx_device_vector *vdev, const gs_gstate *pgs, /* added for gs 8.15 */ const gx_drawing_color *pdc) -#else -static int -opvp_setstrokecolor(gx_device_vector *vdev, const gx_drawing_color *pdc) -#endif { gx_device_opvp *pdev = (gx_device_opvp *)vdev; opvp_result_t r = -1; diff --git a/contrib/pcl3/eprn/gdeveprn.h b/contrib/pcl3/eprn/gdeveprn.h index e71799bd..b079d002 100644 --- a/contrib/pcl3/eprn/gdeveprn.h +++ b/contrib/pcl3/eprn/gdeveprn.h @@ -646,7 +646,6 @@ extern void eprn_set_media_flags(eprn_Device *dev, ms_MediaCode desired, /*****************************************************************************/ -/* Device procedures */ extern dev_proc_open_device(eprn_open_device); extern dev_proc_get_initial_matrix(eprn_get_initial_matrix); extern dev_proc_output_page(eprn_output_page); @@ -666,84 +665,6 @@ extern dev_proc_map_cmyk_color(eprn_map_cmyk_color_max); extern dev_proc_map_cmyk_color(eprn_map_cmyk_color_glob); extern dev_proc_fillpage(eprn_fillpage); -/* Macro for initializing device procedure tables - - This macro corresponds to the macro prn_params_procs() which is used when - basing a device directly on the prn device. - - If your device does not need all of the procedures in the argument list, - use the following defaults: - p_open: eprn_open_device - p_close: eprn_close_device - p_get_params: eprn_get_params - p_put_params: eprn_put_params - On the other hand, if your driver needs its own procedure in any of these - cases its code must also call the appropriate default routine. -*/ -#define eprn_procs_initdata(p_open, p_close, p_get_params, p_put_params) \ - p_open, /* open_device */ \ - eprn_get_initial_matrix, /* get_initial_matrix */ \ - NULL, /* sync_output */ \ - eprn_output_page, /* output_page */ \ - p_close, /* close_device */ \ - eprn_map_rgb_color_for_CMY_or_K, /* map_rgb_color */ \ - eprn_map_color_rgb, /* map_color_rgb */ \ - NULL, /* fill_rectangle */ \ - NULL, /* tile_rectangle */ \ - NULL, /* copy_mono */ \ - NULL, /* copy_color */ \ - NULL, /* draw_line */ \ - NULL, /* get_bits */ \ - p_get_params, /* get_params */ \ - p_put_params, /* put_params */ \ - eprn_map_cmyk_color_glob, /* map_cmyk_color */ \ - NULL, /* get_xfont_procs */ \ - NULL, /* get_xfont_device */ \ - NULL, /* map_rgb_alpha_color */ \ - gx_page_device_get_page_device, /* get_page_device */ \ - NULL, /* get_alpha_bits */ \ - NULL, /* copy_alpha */ \ - NULL, /* get_band */ \ - NULL, /* copy_rop */ \ - NULL, /* fill_path */ \ - NULL, /* stroke_path */ \ - NULL, /* fill_mask */ \ - NULL, /* fill_trapezoid */ \ - NULL, /* fill_parallelogram */ \ - NULL, /* fill_triangle */ \ - NULL, /* draw_thin_line */ \ - NULL, /* begin_image */ \ - NULL, /* image_data */ \ - NULL, /* end_image */ \ - NULL, /* strip_tile_rectangle */ \ - NULL, /* strip_copy_rop */ \ - NULL, /* get_clipping_box */ \ - NULL, /* begin_typed_image */ \ - NULL, /* get_bits_rectangle */ \ - NULL, /* map_color_rgb_alpha */ \ - NULL, /* create_compositor */ \ - NULL, /* get_hardware_params */ \ - NULL, /* text_begin */ \ - NULL, /* finish_copydevice */ \ - NULL, /* begin_transparency_group */ \ - NULL, /* end_transparency_group */ \ - NULL, /* begin_transparency_mask */ \ - NULL, /* end_transparency_mask */ \ - NULL, /* discard_transparency_layer */\ - NULL, /* get_color_mapping_procs */ \ - NULL, /* get_color_comp_index */ \ - NULL, /* encode_color */ \ - NULL, /* decode_color */ \ - NULL, /* pattern_manage */ \ - NULL, /* fill_rectangle_hl_color */ \ - NULL, /* include_color_space */ \ - NULL, /* fill_linear_color_scanline */\ - NULL, /* fill_linear_color_trapezoid */ \ - NULL, /* fill_linear_color_triangle */\ - NULL, /* update_spot_equivalent_colors */\ - NULL, /* ret_devn_params */ \ - eprn_fillpage /* fillpage */ - /* The remaining fields should be NULL. */ /*****************************************************************************/ diff --git a/contrib/pcl3/src/gdevpcl3.c b/contrib/pcl3/src/gdevpcl3.c index 6b6468e0..5e3e8f80 100644 --- a/contrib/pcl3/src/gdevpcl3.c +++ b/contrib/pcl3/src/gdevpcl3.c @@ -92,10 +92,21 @@ static dev_proc_close_device(pcl3_close_device); static dev_proc_get_params(pcl3_get_params); static dev_proc_put_params(pcl3_put_params); -/* Device procedure table */ -static gx_device_procs pcl3_procs = { - eprn_procs_initdata(pcl3_open_device, pcl3_close_device, pcl3_get_params, - pcl3_put_params) +/* Device procedures */ +static void +eprn_initialize_device_procs(gx_device *dev) +{ + gdev_prn_initialize_device_procs(dev); + + set_dev_proc(dev, open_device, pcl3_open_device); + set_dev_proc(dev, get_initial_matrix, eprn_get_initial_matrix); + set_dev_proc(dev, close_device, pcl3_close_device); + set_dev_proc(dev, map_rgb_color, eprn_map_rgb_color_for_CMY_or_K); + set_dev_proc(dev, map_color_rgb, eprn_map_color_rgb); + set_dev_proc(dev, map_cmyk_color, eprn_map_cmyk_color_glob); + set_dev_proc(dev, get_params, pcl3_get_params); + set_dev_proc(dev, put_params, pcl3_put_params); + set_dev_proc(dev, fillpage, eprn_fillpage); }; /* prn procedure implementations */ @@ -129,7 +140,7 @@ static void pcl3_flag_mismatch_reporter( pcl3_Device gs_##dname##_device = { \ eprn_device_initdata( \ pcl3_Device, /* device type */ \ - pcl3_procs, /* static device procedure table */ \ + eprn_initialize_device_procs, /* initialize dev_procs */ \ #dname, /* device name */ \ 300.0, 300.0, /* horizontal and vertical resolution */\ pcl3_print_page, /* print page routine */ \ diff --git a/contrib/pcl3/src/pcl3opts.c b/contrib/pcl3/src/pcl3opts.c index edd28ded..51e9cce3 100644 --- a/contrib/pcl3/src/pcl3opts.c +++ b/contrib/pcl3/src/pcl3opts.c @@ -754,6 +754,7 @@ static int action_CRD(gp_file *in, const pcl_Command *cmd, void *i) /* NLS: 30 * for the reliability of the program! */ if (2 + buffer[1]*6 != cmd->i) { emessage(30, "Illegal field length in Configure Raster Data command.\n"); + free(buffer); return -1; } |