diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2021-10-28 19:32:35 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2021-10-29 13:26:16 -0700 |
commit | 4f32bfe2a2eebcdb9b643d5a36c6ac662b0d6d5b (patch) | |
tree | 6b710270c9b1560ebd823f93e4eb5c2d28ab0de0 | |
parent | 8f62213019bc682eeb0ed9467d8841f3770cfda6 (diff) | |
download | ghostpdl-4f32bfe2a2eebcdb9b643d5a36c6ac662b0d6d5b.tar.gz |
Bug 704639 Avoid writing halftones into clist
If the target device is a contone device there is no
need to write and read halftone data into and out of
the clist.
-rw-r--r-- | base/gdevdflt.c | 9 | ||||
-rw-r--r-- | base/gsht.c | 5 | ||||
-rw-r--r-- | base/gxclimag.c | 4 | ||||
-rw-r--r-- | base/gxdevice.h | 4 |
4 files changed, 19 insertions, 3 deletions
diff --git a/base/gdevdflt.c b/base/gdevdflt.c index 638b66eab..413bb1444 100644 --- a/base/gdevdflt.c +++ b/base/gdevdflt.c @@ -376,6 +376,15 @@ set_linear_color_bits_mask_shift(gx_device * dev) /* Determine if a number is a power of two. Works only for integers. */ #define is_power_of_two(x) ((((x) - 1) & (x)) == 0) +/* A brutish way to check if we are a HT device */ +bool +device_is_contone(gx_device* pdev) +{ + if ((float)pdev->color_info.depth / (float)pdev->color_info.num_components >= 8) + return true; + return false; +} + /* * This routine attempts to determine if a device's encode_color procedure * produces gx_color_index values which are 'separable'. A 'separable' value diff --git a/base/gsht.c b/base/gsht.c index 76838723c..e9ad49a17 100644 --- a/base/gsht.c +++ b/base/gsht.c @@ -1305,7 +1305,10 @@ gx_gstate_set_effective_xfer(gs_gstate * pgs) } } - if (pdht) { /* might not be initialized yet */ + /* HT may not be initialized yet. Only do if the target is a halftone device. + Per the spec, the HT is a self-contained description of a halftoning process. + We don't use any xfer function from the HT if we are not halftoning */ + if (pdht && !device_is_contone(pgs->device)) { /* Since the transfer function is pickled into the threshold array (if any)*/ /* we need to free it so it can be reconstructed with the current transfer */ diff --git a/base/gxclimag.c b/base/gxclimag.c index 37421198b..5bb179e33 100644 --- a/base/gxclimag.c +++ b/base/gxclimag.c @@ -1588,8 +1588,8 @@ cmd_put_color_mapping(gx_device_clist_writer * cldev, int code; const gx_device_halftone *pdht = gx_select_dev_ht(pgs); - /* Put out the halftone, if present. */ - if (pdht && pdht->id != cldev->device_halftone_id) { + /* Put out the halftone, if present, and target is not contone. */ + if (pdht && pdht->id != cldev->device_halftone_id && !device_is_contone(cldev->target)) { code = cmd_put_halftone(cldev, pdht); if (code < 0) return code; diff --git a/base/gxdevice.h b/base/gxdevice.h index 55c0a045c..c01950e9d 100644 --- a/base/gxdevice.h +++ b/base/gxdevice.h @@ -434,6 +434,10 @@ void gx_device_forward_color_procs(gx_device_forward *); */ void check_device_separable(gx_device * dev); /* + * Is this a contone device? + */ +bool device_is_contone(gx_device* pdev); +/* * Check if the device's encode_color routine uses a pdf14 compatible * encoding. For more info see the routine's header. */ |