summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2021-09-21 14:21:26 +0100
committerKen Sharp <ken.sharp@artifex.com>2021-09-21 14:21:47 +0100
commitab0ecb7d44cfc2cf90dcb67c4bafc7ebf5bd5a58 (patch)
treef0ae284c1fdd8b10c2df6a5b3a1aeca6fdbd2dc2 /base
parent73ff3b1d6506660895d886270a4cb86c5319bbf9 (diff)
downloadghostpdl-ab0ecb7d44cfc2cf90dcb67c4bafc7ebf5bd5a58.tar.gz
Change the update_spot_equivalent_colors device method
This device method was using the current colour space to retrieve equivalent colours for DeviceN/Separation inks, but that causes a problem for GhostPDF because, for images, it does not set the current colour space in the graphics state to be the image colour space. It turns out that the two places which call this device method; gx_install_Separation() and gx_install_DeviceN() already have the colour space that we want to use so its simple to just pass along the colour space, rather than forcing us to set the current space in the graphics state. I have updated update_spot_equivalent_cmyk_colors() so that if it is ever called with a NULL pointer for the colour space it will fall back to using the current colour space. This doesn't cause any diffs, but it does mean that when pdfi draws an image in a Separation or DeviceN space, the graphics library uses the correct colour space to determine the spot equivalents.
Diffstat (limited to 'base')
-rw-r--r--base/gdevdevn.c4
-rw-r--r--base/gdevdflt.c2
-rw-r--r--base/gdevnfwd.c4
-rw-r--r--base/gdevp14.c12
-rw-r--r--base/gdevsclass.c4
-rw-r--r--base/gscdevn.c2
-rw-r--r--base/gscsepr.c2
-rw-r--r--base/gsequivc.c10
-rw-r--r--base/gsequivc.h3
-rw-r--r--base/gsicc_manage.c2
-rw-r--r--base/gxdevcli.h2
11 files changed, 25 insertions, 22 deletions
diff --git a/base/gdevdevn.c b/base/gdevdevn.c
index f67912768..5e85fd7a1 100644
--- a/base/gdevdevn.c
+++ b/base/gdevdevn.c
@@ -1185,11 +1185,11 @@ gx_devn_prn_ret_devn_params_const(const gx_device * dev)
* Device proc for updating the equivalent CMYK color for spot colors.
*/
int
-gx_devn_prn_update_spot_equivalent_colors(gx_device *dev, const gs_gstate * pgs)
+gx_devn_prn_update_spot_equivalent_colors(gx_device *dev, const gs_gstate * pgs, const gs_color_space *pcs)
{
gx_devn_prn_device *pdev = (gx_devn_prn_device *)dev;
- return update_spot_equivalent_cmyk_colors(dev, pgs, &pdev->devn_params,
+ return update_spot_equivalent_cmyk_colors(dev, pgs, pcs, &pdev->devn_params,
&pdev->equiv_cmyk_colors);
}
diff --git a/base/gdevdflt.c b/base/gdevdflt.c
index 71d8c1c7f..638b66eab 100644
--- a/base/gdevdflt.c
+++ b/base/gdevdflt.c
@@ -1027,7 +1027,7 @@ gx_default_include_color_space(gx_device *pdev, gs_color_space *cspace,
* src/gsequivc.c.
*/
int
-gx_default_update_spot_equivalent_colors(gx_device *pdev, const gs_gstate * pgs)
+gx_default_update_spot_equivalent_colors(gx_device *pdev, const gs_gstate * pgs, const gs_color_space *pcs)
{
return 0;
}
diff --git a/base/gdevnfwd.c b/base/gdevnfwd.c
index f761750bc..948bfa09e 100644
--- a/base/gdevnfwd.c
+++ b/base/gdevnfwd.c
@@ -809,14 +809,14 @@ gx_forward_fill_linear_color_triangle(gx_device *dev, const gs_fill_attributes *
}
int
-gx_forward_update_spot_equivalent_colors(gx_device *dev, const gs_gstate * pgs)
+gx_forward_update_spot_equivalent_colors(gx_device *dev, const gs_gstate * pgs, const gs_color_space *pcs)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
int code = 0;
if (tdev != NULL)
- code = dev_proc(tdev, update_spot_equivalent_colors)(tdev, pgs);
+ code = dev_proc(tdev, update_spot_equivalent_colors)(tdev, pgs, pcs);
return code;
}
diff --git a/base/gdevp14.c b/base/gdevp14.c
index d7992bc42..41b16e2a8 100644
--- a/base/gdevp14.c
+++ b/base/gdevp14.c
@@ -10214,33 +10214,31 @@ pdf14_accum_get_color_mapping_procs(const gx_device * dev, const gx_device **map
* Device proc for updating the equivalent CMYK color for spot colors.
*/
static int
-pdf14_accum_update_spot_equivalent_colors(gx_device * dev, const gs_gstate * pgs)
+pdf14_accum_update_spot_equivalent_colors(gx_device * dev, const gs_gstate * pgs, const gs_color_space *pcs)
{
gx_device_pdf14_accum *pdev = (gx_device_pdf14_accum *)dev;
gx_device *tdev = ((pdf14_device *)(pdev->save_p14dev))->target;
- int code = update_spot_equivalent_cmyk_colors(dev, pgs, &pdev->devn_params,
+ int code = update_spot_equivalent_cmyk_colors(dev, pgs, pcs, &pdev->devn_params,
&pdev->equiv_cmyk_colors);
if (code >= 0 && tdev != NULL)
- code = dev_proc(tdev, update_spot_equivalent_colors)(tdev, pgs);
+ code = dev_proc(tdev, update_spot_equivalent_colors)(tdev, pgs, pcs);
return code;
}
/* Used when doing overprint simulation and have spot colors */
static int
-pdf14_update_spot_equivalent_colors(gx_device *dev, const gs_gstate *pgs)
+pdf14_update_spot_equivalent_colors(gx_device *dev, const gs_gstate *pgs, const gs_color_space *pcs)
{
pdf14_device *pdev = (pdf14_device *)dev;
- const gs_color_space *pcs;
int code;
/* Make sure we are not All or None */
- pcs = gs_currentcolorspace_inline(pgs);
if (pcs != NULL && pcs->type->index == gs_color_space_index_Separation &&
pcs->params.separation.sep_type != SEP_OTHER)
return 0;
- code = update_spot_equivalent_cmyk_colors(dev, pgs, &pdev->devn_params,
+ code = update_spot_equivalent_cmyk_colors(dev, pgs, pcs, &pdev->devn_params,
&pdev->op_pequiv_cmyk_colors);
return code;
}
diff --git a/base/gdevsclass.c b/base/gdevsclass.c
index aec268939..2f757b769 100644
--- a/base/gdevsclass.c
+++ b/base/gdevsclass.c
@@ -596,10 +596,10 @@ int default_subclass_fill_linear_color_triangle(gx_device *dev, const gs_fill_at
return gx_default_fill_linear_color_triangle(dev, fa, p0, p1, p2, c0, c1, c2);
}
-int default_subclass_update_spot_equivalent_colors(gx_device *dev, const gs_gstate * pgs)
+int default_subclass_update_spot_equivalent_colors(gx_device *dev, const gs_gstate * pgs, const gs_color_space *pcs)
{
if (dev->child)
- return dev_proc(dev->child, update_spot_equivalent_colors)(dev->child, pgs);
+ return dev_proc(dev->child, update_spot_equivalent_colors)(dev->child, pgs, pcs);
return 0;
}
diff --git a/base/gscdevn.c b/base/gscdevn.c
index 41febb7f9..a7a933505 100644
--- a/base/gscdevn.c
+++ b/base/gscdevn.c
@@ -747,7 +747,7 @@ gx_install_DeviceN(gs_color_space * pcs, gs_gstate * pgs)
if (code >= 0) {
if (dev_proc(pgs->device, update_spot_equivalent_colors))
code = dev_proc(pgs->device, update_spot_equivalent_colors)
- (pgs->device, pgs);
+ (pgs->device, pgs, pcs);
}
return code;
}
diff --git a/base/gscsepr.c b/base/gscsepr.c
index 104001065..ce7c55373 100644
--- a/base/gscsepr.c
+++ b/base/gscsepr.c
@@ -172,7 +172,7 @@ gx_install_Separation(gs_color_space * pcs, gs_gstate * pgs)
*/
if (dev_proc(pgs->device, update_spot_equivalent_colors))
code = dev_proc(pgs->device, update_spot_equivalent_colors)
- (pgs->device, pgs);
+ (pgs->device, pgs, pcs);
}
return code;
}
diff --git a/base/gsequivc.c b/base/gsequivc.c
index e2b9c33dd..d56d4b533 100644
--- a/base/gsequivc.c
+++ b/base/gsequivc.c
@@ -283,10 +283,10 @@ static bool check_all_colors_known(int num_spot,
/* If possible, update the equivalent CMYK color for a spot color */
int
-update_spot_equivalent_cmyk_colors(gx_device * pdev, const gs_gstate * pgs,
+update_spot_equivalent_cmyk_colors(gx_device * pdev, const gs_gstate * pgs, const gs_color_space * pcs_in,
gs_devn_params * pdevn_params, equivalent_cmyk_color_params * pparams)
{
- const gs_color_space * pcs;
+ gs_color_space * pcs = pcs_in;
cmm_dev_profile_t *dev_profile;
int code;
@@ -303,12 +303,16 @@ update_spot_equivalent_cmyk_colors(gx_device * pdev, const gs_gstate * pgs,
pparams->all_color_info_valid = true;
return 0;
}
+
+ /* If the caller apssed in NULL for the colour space, use the current colour space */
+ if (pcs_in == NULL)
+ pcs = gs_currentcolorspace_inline(pgs);
+
/*
* Verify that the given color space is a Separation or a DeviceN color
* space. If so then when check if the color space contains a separation
* color for which we need a CMYK equivalent.
*/
- pcs = gs_currentcolorspace_inline(pgs);
if (pcs != NULL) {
if (pcs->type->index == gs_color_space_index_Separation) {
update_Separation_spot_equivalent_cmyk_colors(pdev, pgs, pcs,
diff --git a/base/gsequivc.h b/base/gsequivc.h
index 0ea3ead44..d5501b2df 100644
--- a/base/gsequivc.h
+++ b/base/gsequivc.h
@@ -61,7 +61,8 @@ typedef struct equivalent_cmyk_color_params_s {
* If possible, update the equivalent CMYK color for spot colors.
*/
int update_spot_equivalent_cmyk_colors(gx_device * pdev,
- const gs_gstate * pgs, gs_devn_params * pdevn_params,
+ const gs_gstate * pgs, const gs_color_space * pcs,
+ gs_devn_params * pdevn_params,
equivalent_cmyk_color_params * pparams);
/*
diff --git a/base/gsicc_manage.c b/base/gsicc_manage.c
index 0842628d8..9ea1e3512 100644
--- a/base/gsicc_manage.c
+++ b/base/gsicc_manage.c
@@ -1546,7 +1546,7 @@ gsicc_set_devicen_equiv_colors(gx_device *dev, const gs_gstate * pgs,
return gs_throw(gs_error_VMerror, "Insufficient memory for devn equiv colors");
pcspace->cmm_icc_profile_data = profile;
temp_state.color[0].color_space = pcspace;
- return dev_proc(dev, update_spot_equivalent_colors)(dev, &temp_state);
+ return dev_proc(dev, update_spot_equivalent_colors)(dev, &temp_state, pcspace);
}
#define DEFAULT_ICC_PROCESS "Cyan, Magenta, Yellow, Black,"
diff --git a/base/gxdevcli.h b/base/gxdevcli.h
index 9364349c0..2476ea338 100644
--- a/base/gxdevcli.h
+++ b/base/gxdevcli.h
@@ -1295,7 +1295,7 @@ typedef struct gs_fill_attributes_s {
* start of src/gsequivc.c.
*/
#define dev_t_proc_update_spot_equivalent_colors(proc, dev_t)\
- int proc(dev_t *dev, const gs_gstate * pgs)
+ int proc(dev_t *dev, const gs_gstate * pgs, const gs_color_space *pcs)
#define dev_proc_update_spot_equivalent_colors(proc)\
dev_t_proc_update_spot_equivalent_colors(proc, gx_device)