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 /cups | |
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 'cups')
-rw-r--r-- | cups/gdevcups.c | 185 |
1 files changed, 66 insertions, 119 deletions
diff --git a/cups/gdevcups.c b/cups/gdevcups.c index 84c535fc..a9dbc142 100644 --- a/cups/gdevcups.c +++ b/cups/gdevcups.c @@ -312,94 +312,32 @@ typedef struct gx_device_cups_s /* Used by cups_put_params(): */ } gx_device_cups; -private gx_device_procs cups_procs = +static void +cups_initialize_device_procs(gx_device *dev) { - cups_open, - cups_get_matrix, - cups_sync_output, - cups_output_page, - cups_close, + set_dev_proc(dev, open_device, cups_open); + set_dev_proc(dev, get_initial_matrix, cups_get_matrix); + set_dev_proc(dev, sync_output, cups_sync_output); + set_dev_proc(dev, output_page, cups_output_page); + set_dev_proc(dev, close_device, cups_close); #ifdef dev_t_proc_encode_color - NULL, /* map_rgb_color */ - NULL, /* map_color_rgb */ + set_dev_proc(dev, get_color_mapping_procs, cups_get_color_mapping_procs); + set_dev_proc(dev, get_color_comp_index, cups_get_color_comp_index); + set_dev_proc(dev, encode_color, cups_encode_color); + set_dev_proc(dev, decode_color, cups_decode_color); #else - cups_map_rgb_color, - cups_map_color_rgb, -#endif /* dev_t_proc_encode_color */ - NULL, /* fill_rectangle */ - NULL, /* tile_rectangle */ - NULL, /* copy_mono */ - NULL, /* copy_color */ - NULL, /* draw_line */ - gx_default_get_bits, - cups_get_params, - cups_put_params, -#ifdef dev_t_proc_encode_color - NULL, /* map_cmyk_color */ -#else - cups_map_cmyk_color, -#endif /* dev_t_proc_encode_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 */ - 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 */ -#ifdef dev_t_proc_encode_color - cups_get_color_mapping_procs, - cups_get_color_comp_index, - cups_encode_color, - cups_decode_color, -#else - NULL, /* get_color_mapping_procs */ - NULL, /* get_color_comp_index */ - NULL, /* encode_color */ - NULL, /* decode_color */ -#endif /* dev_t_proc_encode_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 */ - NULL, /* fillpage */ - NULL, /* push_transparency_state */ - NULL, /* pop_transparency_state */ - NULL, /* put_image */ - cups_spec_op -}; + set_dev_proc(dev, map_rgb_color, cups_map_rgb_color); + set_dev_proc(dev, map_color_rgb, cups_map_color_rgb); + set_dev_proc(dev, map_cmyk_color, cups_map_cmyk_color); +#endif + set_dev_proc(dev, get_params, cups_get_params); + set_dev_proc(dev, put_params, cups_put_params); + set_dev_proc(dev, get_page_device, gx_page_device_get_page_device); + set_dev_proc(dev, dev_spec_op, cups_spec_op); +} -#define prn_device_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_pages)\ - std_device_full_body_type(dtype, &procs, dname, &st_device_printer,\ +#define prn_device_body_copies(dtype, init, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_pages)\ + std_device_full_body_type(dtype, init, dname, &st_device_printer,\ (int)((long)(w10) * (xdpi) / 10),\ (int)((long)(h10) * (ydpi) / 10),\ xdpi, ydpi,\ @@ -433,7 +371,7 @@ private gx_device_procs cups_procs = #define gs_xxx_device(dname, mediaclass)\ prn_device_body_copies(gx_device_cups,/* type */\ - cups_procs, /* procedures */\ + cups_initialize_device_procs,/* init */\ dname, /* device name */\ 85, /* initial width */\ 110, /* initial height */\ @@ -859,9 +797,10 @@ cups_get_color_comp_index(gx_device * pdev, const char * pname, */ private const gx_cm_color_map_procs * /* O - List of device procedures */ -cups_get_color_mapping_procs(const gx_device *pdev) +cups_get_color_mapping_procs(const gx_device *pdev, const gx_device **tdev) /* I - Device info */ { + *tdev = pdev; return (&cups_color_mapping_procs); } #endif /* dev_t_proc_encode_color */ @@ -1254,7 +1193,7 @@ cups_map_cielab(double x, /* I - Raw color value */ */ private void -cups_map_cmyk(gx_device *pdev, /* I - Device info */ +cups_map_cmyk(const gx_device *pdev, /* I - Device info */ frac c, /* I - Cyan value */ frac m, /* I - Magenta value */ frac y, /* I - Yellow value */ @@ -1723,7 +1662,7 @@ cups_map_cmyk(gx_device *pdev, /* I - Device info */ */ private void -cups_map_gray(gx_device *pdev, /* I - Device info */ +cups_map_gray(const gx_device *pdev, /* I - Device info */ frac g, /* I - Grayscale value */ frac *out) /* O - Device colors */ { @@ -1745,7 +1684,7 @@ cups_map_gray(gx_device *pdev, /* I - Device info */ */ private void -cups_map_rgb(gx_device *pdev, +cups_map_rgb(const gx_device *pdev, /* I - Device info */ const gs_gstate *pgs,/* I - Device state */ frac r, /* I - Red value */ @@ -4009,17 +3948,17 @@ cups_put_params(gx_device *pdev, /* I - Device info */ if (cups->landscape) { - width = (pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3]) * - pdev->HWResolution[0] / 72.0f + 0.499f; - height = (pdev->MediaSize[0] - pdev->HWMargins[0] - pdev->HWMargins[2]) * - pdev->HWResolution[1] / 72.0f + 0.499f; + width = (int)((pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3]) * + pdev->HWResolution[0] / 72.0f + 0.499f); + height = (int)((pdev->MediaSize[0] - pdev->HWMargins[0] - pdev->HWMargins[2]) * + pdev->HWResolution[1] / 72.0f + 0.499f); } else { - width = (pdev->MediaSize[0] - pdev->HWMargins[0] - pdev->HWMargins[2]) * - pdev->HWResolution[0] / 72.0f + 0.499f; - height = (pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3]) * - pdev->HWResolution[1] / 72.0f + 0.499f; + width = (int)((pdev->MediaSize[0] - pdev->HWMargins[0] - pdev->HWMargins[2]) * + pdev->HWResolution[0] / 72.0f + 0.499f); + height = (int)((pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3]) * + pdev->HWResolution[1] / 72.0f + 0.499f); } if (width <= 0 || height <= 0) { @@ -4030,8 +3969,8 @@ cups_put_params(gx_device *pdev, /* I - Device info */ #ifdef CUPS_RASTER_SYNCv1 if (cups->header.cupsBorderlessScalingFactor > 1.0) { - width *= cups->header.cupsBorderlessScalingFactor; - height *= cups->header.cupsBorderlessScalingFactor; + width = (int)(width * cups->header.cupsBorderlessScalingFactor); + height = (int)(height * cups->header.cupsBorderlessScalingFactor); } #endif /* CUPS_RASTER_SYNCv1 */ @@ -4086,8 +4025,8 @@ cups_put_params(gx_device *pdev, /* I - Device info */ * Set CUPS raster header values... */ - cups->header.HWResolution[0] = pdev->HWResolution[0]; - cups->header.HWResolution[1] = pdev->HWResolution[1]; + cups->header.HWResolution[0] = (unsigned int)pdev->HWResolution[0]; + cups->header.HWResolution[1] = (unsigned int)pdev->HWResolution[1]; #ifdef CUPS_RASTER_SYNCv1 @@ -4099,19 +4038,23 @@ cups_put_params(gx_device *pdev, /* I - Device info */ if ((sf = cups->header.cupsBorderlessScalingFactor) < 1.0) sf = 1.0; - cups->header.PageSize[0] = (cups_mediasize[1] * sf) + 0.5; - cups->header.PageSize[1] = (cups_mediasize[0] * sf) + 0.5; + cups->header.PageSize[0] = (unsigned int)((cups_mediasize[1] * sf) + 0.5); + cups->header.PageSize[1] = (unsigned int)((cups_mediasize[0] * sf) + 0.5); if (strcasecmp(cups->header.MediaClass, "PwgRaster") != 0) { - cups->header.Margins[0] = (cups_margins[1] * sf) + 0.5; - cups->header.Margins[1] = (cups_margins[2] * sf) + 0.5; - cups->header.ImagingBoundingBox[0] = (cups_margins[1] * sf) + 0.5; - cups->header.ImagingBoundingBox[1] = (cups_margins[2] * sf) + 0.5; - cups->header.ImagingBoundingBox[2] = ((cups_mediasize[1] - - cups_margins[3]) * sf) + 0.5; - cups->header.ImagingBoundingBox[3] = ((cups_mediasize[0] - - cups_margins[0]) * sf) + 0.5; + cups->header.Margins[0] = (unsigned int)((cups_margins[1] * sf) + 0.5); + cups->header.Margins[1] = (unsigned int)((cups_margins[2] * sf) + 0.5); + cups->header.ImagingBoundingBox[0] = + (unsigned int)((cups_margins[1] * sf) + 0.5); + cups->header.ImagingBoundingBox[1] = + (unsigned int)((cups_margins[2] * sf) + 0.5); + cups->header.ImagingBoundingBox[2] = + (unsigned int)(((cups_mediasize[1] - + cups_margins[3]) * sf) + 0.5); + cups->header.ImagingBoundingBox[3] = + (unsigned int)(((cups_mediasize[0] - + cups_margins[0]) * sf) + 0.5); cups->header.cupsImagingBBox[0] = cups_margins[1]; cups->header.cupsImagingBBox[1] = cups_margins[2]; cups->header.cupsImagingBBox[2] = cups_mediasize[1] - cups_margins[3]; @@ -4136,19 +4079,23 @@ cups_put_params(gx_device *pdev, /* I - Device info */ if ((sf = cups->header.cupsBorderlessScalingFactor) < 1.0) sf = 1.0; - cups->header.PageSize[0] = (cups_mediasize[0] * sf) + 0.5; - cups->header.PageSize[1] = (cups_mediasize[1] * sf) + 0.5; + cups->header.PageSize[0] = (unsigned int)((cups_mediasize[0] * sf) + 0.5); + cups->header.PageSize[1] = (unsigned int)((cups_mediasize[1] * sf) + 0.5); if (strcasecmp(cups->header.MediaClass, "PwgRaster") != 0) { cups->header.Margins[0] = (cups_margins[0] * sf) + 0.5; cups->header.Margins[1] = (cups_margins[1] * sf) + 0.5; - cups->header.ImagingBoundingBox[0] = (cups_margins[0] * sf) + 0.5; - cups->header.ImagingBoundingBox[1] = (cups_margins[1] * sf) + 0.5; - cups->header.ImagingBoundingBox[2] = ((cups_mediasize[0] - - cups_margins[2]) * sf) + 0.5; - cups->header.ImagingBoundingBox[3] = ((cups_mediasize[1] - - cups_margins[3]) * sf) + 0.5; + cups->header.ImagingBoundingBox[0] = + (unsigned int)((cups_margins[0] * sf) + 0.5); + cups->header.ImagingBoundingBox[1] = + (unsigned int)((cups_margins[1] * sf) + 0.5); + cups->header.ImagingBoundingBox[2] = + (unsigned int)(((cups_mediasize[0] - + cups_margins[2]) * sf) + 0.5); + cups->header.ImagingBoundingBox[3] = + (unsigned int)(((cups_mediasize[1] - + cups_margins[3]) * sf) + 0.5); cups->header.cupsImagingBBox[0] = cups_margins[0]; cups->header.cupsImagingBBox[1] = cups_margins[1]; cups->header.cupsImagingBBox[2] = cups_mediasize[0] - cups_margins[2]; |