summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Johnston <ray.johnston@artifex.com>2013-06-12 12:39:13 -0700
committerRay Johnston <ray.johnston@artifex.com>2013-06-13 11:21:17 -0700
commitf75e1cf3d4f4e4e809e94efc29b4046fe07f00c5 (patch)
tree47cd5bc111ef08b4d034e0397c3d7035f82e12df
parent5dd1d9a83d41ea9d2542e435172ff4fa7c163828 (diff)
downloadghostpdl-f75e1cf3d4f4e4e809e94efc29b4046fe07f00c5.tar.gz
Fix Graydetection for pages after the first color page for cust 801.
We need to restore pageneutralcolor if graydetection is true, but also we need to reestablish the monitoring color procedures, so we add a gsicc_mcm_begin_monitor for the purpose. We change the pdf14 device hook to allow the target device monitoring to be turned on or off.
-rw-r--r--gs/base/gdevp14.c4
-rw-r--r--gs/base/gdevp14.h4
-rw-r--r--gs/base/gdevprn.c1
-rw-r--r--gs/base/gscms.h1
-rw-r--r--gs/base/gsdevice.c11
-rw-r--r--gs/base/gsicc_cache.c3
-rw-r--r--gs/base/gsicc_cms.h3
-rw-r--r--gs/base/gsicc_monitorcm.c44
-rw-r--r--gs/base/gsicc_nocm.c125
-rw-r--r--gs/base/gsicc_replacecm.c2
-rw-r--r--gs/devices/gdevpbm.c1
11 files changed, 126 insertions, 73 deletions
diff --git a/gs/base/gdevp14.c b/gs/base/gdevp14.c
index b4f08ad02..dd1c9e32a 100644
--- a/gs/base/gdevp14.c
+++ b/gs/base/gdevp14.c
@@ -5099,9 +5099,9 @@ pdf14_dev_spec_op(gx_device *pdev, int dev_spec_op,
return gx_default_dev_spec_op(pdev, dev_spec_op, data, size);
}
-/* Needed to turn off color monitoring in the target device's profile */
+/* Needed to set color monitoring in the target device's profile */
int
-gs_pdf14_device_color_mon_off(gx_device *pdev)
+gs_pdf14_device_color_mon_set(gx_device *pdev, bool monitoring)
{
pdf14_device * p14dev = (pdf14_device *)pdev;
gx_device *targ = p14dev->target;
diff --git a/gs/base/gdevp14.h b/gs/base/gdevp14.h
index ad91bfad0..e1aea85d6 100644
--- a/gs/base/gdevp14.h
+++ b/gs/base/gdevp14.h
@@ -282,7 +282,7 @@ int pdf14_get_buffer_information(const gx_device * dev,
/* Not static due to call from pattern logic */
int pdf14_disable_device(gx_device * dev);
-/* Needed so that we can turn off the monitoring in the target device */
-int gs_pdf14_device_color_mon_off(gx_device *pdev);
+/* Needed so that we can set the monitoring in the target device */
+int gs_pdf14_device_color_mon_set(gx_device *pdev, bool monitoring);
#endif /* gdevp14_INCLUDED */
diff --git a/gs/base/gdevprn.c b/gs/base/gdevprn.c
index 014c9bed6..7d83e382c 100644
--- a/gs/base/gdevprn.c
+++ b/gs/base/gdevprn.c
@@ -954,7 +954,6 @@ gdev_prn_output_page_aux(gx_device * pdev, int num_copies, int flush, bool seeka
free_separation_names(pdev->memory, &(pdevn_params->separations));
pdevn_params->num_separation_order_names = 0;
}
- pdev->icc_struct->pageneutralcolor = pdev->icc_struct->graydetection; /* start detecting again */
endcode = (PRINTER_IS_CLIST(ppdev) && !ppdev->is_async_renderer ?
clist_finish_page(pdev, flush) : 0);
diff --git a/gs/base/gscms.h b/gs/base/gscms.h
index 5b962917b..770f88867 100644
--- a/gs/base/gscms.h
+++ b/gs/base/gscms.h
@@ -427,6 +427,7 @@ struct gsicc_link_s {
bool valid; /* true once link is completely built and usable */
bool is_monitored;
gscms_procs_t orig_procs; /* procs to use after monitoring */
+ gsicc_colorbuffer_t data_cs; /* needed for begin_monitor after end_monitor */
int num_input; /* Need so we can monitor properly */
int num_output; /* Need so we can monitor properly */
};
diff --git a/gs/base/gsdevice.c b/gs/base/gsdevice.c
index 805666660..5d62fd501 100644
--- a/gs/base/gsdevice.c
+++ b/gs/base/gsdevice.c
@@ -136,6 +136,7 @@ int
gs_output_page(gs_state * pgs, int num_copies, int flush)
{
gx_device *dev = gs_currentdevice(pgs);
+ cmm_dev_profile_t *dev_profile;
int code;
/* for devices that hook 'fill_path' in order to pick up imager state */
@@ -158,7 +159,15 @@ gs_output_page(gs_state * pgs, int num_copies, int flush)
if (dev->IgnoreNumCopies)
num_copies = 1;
- return (*dev_proc(dev, output_page)) (dev, num_copies, flush);
+ if ((code = (*dev_proc(dev, output_page)) (dev, num_copies, flush)) < 0)
+ return code;
+
+ code = dev_proc(dev, get_profile)(dev, &(dev_profile));
+ if (dev_profile->graydetection && !dev_profile->pageneutralcolor) {
+ dev_profile->pageneutralcolor = true; /* start detecting again */
+ gsicc_mcm_begin_monitor(pgs->icc_link_cache, dev);
+ }
+ return code;
}
/*
diff --git a/gs/base/gsicc_cache.c b/gs/base/gsicc_cache.c
index d64e40e19..504d987f5 100644
--- a/gs/base/gsicc_cache.c
+++ b/gs/base/gsicc_cache.c
@@ -221,8 +221,9 @@ gsicc_set_link_data(gsicc_link_t *icc_link, void *link_handle,
icc_link->valid = true;
/* Set up for monitoring */
+ icc_link->data_cs = data_cs;
if (pageneutralcolor)
- gsicc_mcm_set_link(icc_link, data_cs);
+ gsicc_mcm_set_link(icc_link);
/* Now release any tasks/threads waiting for these contents */
while (icc_link->num_waiting > 0) {
diff --git a/gs/base/gsicc_cms.h b/gs/base/gsicc_cms.h
index 3aa63fee9..7b73ca3fa 100644
--- a/gs/base/gsicc_cms.h
+++ b/gs/base/gsicc_cms.h
@@ -36,8 +36,9 @@
bool gsicc_mcm_monitor_rgb(void *inputcolor, int num_bytes);
bool gsicc_mcm_monitor_cmyk(void *inputcolor, int num_bytes);
bool gsicc_mcm_monitor_lab(void *inputcolor, int num_bytes);
-void gsicc_mcm_set_link(gsicc_link_t* link, gsicc_colorbuffer_t data_cs);
+void gsicc_mcm_set_link(gsicc_link_t* link);
void gsicc_mcm_end_monitor(gsicc_link_cache_t *cache, gx_device *dev);
+void gsicc_mcm_begin_monitor(gsicc_link_cache_t *cache, gx_device *dev);
gsicc_link_t* gsicc_rcm_get_link(const gs_imager_state *pis, gx_device *dev,
gsicc_colorbuffer_t data_cs);
gsicc_link_t* gsicc_nocm_get_link(const gs_imager_state *pis, gx_device *dev,
diff --git a/gs/base/gsicc_monitorcm.c b/gs/base/gsicc_monitorcm.c
index 4421b27eb..0cc1252d3 100644
--- a/gs/base/gsicc_monitorcm.c
+++ b/gs/base/gsicc_monitorcm.c
@@ -359,7 +359,7 @@ bool gsicc_mcm_monitor_lab(void *inputcolor, int num_bytes)
/* Set the link up to monitor */
void
-gsicc_mcm_set_link(gsicc_link_t* link, gsicc_colorbuffer_t data_cs)
+gsicc_mcm_set_link(gsicc_link_t* link)
{
link->orig_procs = link->procs;
link->is_monitored = true;
@@ -368,7 +368,7 @@ gsicc_mcm_set_link(gsicc_link_t* link, gsicc_colorbuffer_t data_cs)
link->procs.map_buffer = gsicc_mcm_transform_color_buffer;
link->procs.map_color = gsicc_mcm_transform_color;
- switch (data_cs) {
+ switch (link->data_cs) {
case gsRGB:
link->procs.is_color = gsicc_mcm_monitor_rgb;
break;
@@ -402,7 +402,7 @@ gsicc_mcm_end_monitor(gsicc_link_cache_t *cache, gx_device *dev)
profile in the target device also. This is a special case since the
pdf14 device has its own profile different from the target device */
if (dev_proc(dev, dev_spec_op)(dev, gxdso_is_pdf14_device, NULL, 0)) {
- code = gs_pdf14_device_color_mon_off(dev);
+ code = gs_pdf14_device_color_mon_set(dev, false);
}
curr = cache->head;
@@ -422,3 +422,41 @@ gsicc_mcm_end_monitor(gsicc_link_cache_t *cache, gx_device *dev)
}
gx_monitor_leave(lock); /* done with updating, let everyone run */
}
+
+/* Conversely to the above, this gets restores monitoring, needed after
+ * monitoring was turned off above (for the next page)
+*/
+void
+gsicc_mcm_begin_monitor(gsicc_link_cache_t *cache, gx_device *dev)
+{
+ gx_monitor_t *lock = cache->lock;
+ gsicc_link_t *curr;
+ int code;
+ cmm_dev_profile_t *dev_profile;
+
+ /* Lock the cache as we remove monitoring from the links */
+ gx_monitor_enter(lock);
+
+ /* Get the device profile */
+ code = dev_proc(dev, get_profile)(dev, &dev_profile);
+ dev_profile->pageneutralcolor = true;
+ /* If this device is a pdf14 device, then we may need to take care of the
+ profile in the target device also. This is a special case since the
+ pdf14 device has its own profile different from the target device */
+ if (dev_proc(dev, dev_spec_op)(dev, gxdso_is_pdf14_device, NULL, 0)) {
+ code = gs_pdf14_device_color_mon_set(dev, true);
+ }
+
+ curr = cache->head;
+ while (curr != NULL ) {
+ if (curr->data_cs != gsGRAY)
+ gsicc_mcm_set_link(curr);
+ /* Now release any tasks/threads waiting for these contents */
+ while (curr->num_waiting > 0) {
+ gx_semaphore_signal(curr->wait);
+ curr->num_waiting--;
+ }
+ curr = curr->next;
+ }
+ gx_monitor_leave(lock); /* done with updating, let everyone run */
+}
diff --git a/gs/base/gsicc_nocm.c b/gs/base/gsicc_nocm.c
index 14dda2c59..881ba8ad9 100644
--- a/gs/base/gsicc_nocm.c
+++ b/gs/base/gsicc_nocm.c
@@ -34,7 +34,7 @@
typedef struct nocm_link_s {
/* device (or default) procs to do the transformation */
gx_cm_color_map_procs cm_procs;
- /* Since RGB to CMYK requires BG and UCR, we need to have the
+ /* Since RGB to CMYK requires BG and UCR, we need to have the
imager state available */
gs_imager_state *pis;
byte num_in;
@@ -42,12 +42,12 @@ typedef struct nocm_link_s {
gs_memory_t *memory;
} nocm_link_t;
-static void gsicc_nocm_transform_general(gx_device *dev, gsicc_link_t *icclink,
- void *inputcolor, void *outputcolor,
+static void gsicc_nocm_transform_general(gx_device *dev, gsicc_link_t *icclink,
+ void *inputcolor, void *outputcolor,
int num_bytes_in, int num_bytes_out);
-/* Functions that should be optimized later to do planar/chunky with
- color conversions. Just putting in something that should work
+/* Functions that should be optimized later to do planar/chunky with
+ color conversions. Just putting in something that should work
right now */
/* At most, we have 4 input and 4 output ptrs. Since this is used only in
@@ -72,14 +72,14 @@ gsicc_nocm_planar_to_planar(gx_device *dev, gsicc_link_t *icclink,
outputpos[k] = out_buffer_ptr + k * input_buff_desc->plane_stride;
}
/* Note to self. We currently only do this in the transparency buffer
- case which has byte representation so just stepping through
+ case which has byte representation so just stepping through
plane_stride is ok at this time. */
for (k = 0; k < input_buff_desc->plane_stride ; k++) {
for (j = 0; j < input_buff_desc->num_chan; j++) {
in_color[j] = *(inputpos[j]);
inputpos[j] += input_buff_desc->bytes_per_chan;
}
- gsicc_nocm_transform_general(dev, icclink, (void*) &(in_color[0]),
+ gsicc_nocm_transform_general(dev, icclink, (void*) &(in_color[0]),
(void*) &(out_color[0]), 1, 1);
for (j = 0; j < output_buff_desc->num_chan; j++) {
*(outputpos[j]) = out_color[j];
@@ -127,8 +127,8 @@ gsicc_nocm_chunky_to_planar(gx_device *dev, gsicc_link_t *icclink,
/* split the 2 byte 1 byte case here to avoid decision in inner loop */
if (output_buff_desc->bytes_per_chan == 1) {
for (j = 0; j < input_buff_desc->pixels_per_row; j++) {
- gsicc_nocm_transform_general(dev, icclink, (void*) inputcolor,
- (void*) &(outputcolor[0]), num_bytes_in,
+ gsicc_nocm_transform_general(dev, icclink, (void*) inputcolor,
+ (void*) &(outputcolor[0]), num_bytes_in,
num_bytes_out);
/* Stuff the output in the proper planar location */
for (m = 0; m < output_buff_desc->num_chan; m++) {
@@ -137,11 +137,11 @@ gsicc_nocm_chunky_to_planar(gx_device *dev, gsicc_link_t *icclink,
inputcolor += pixel_in_step;
}
inputpos += input_buff_desc->row_stride;
- outputpos += output_buff_desc->row_stride;
+ outputpos += output_buff_desc->row_stride;
} else {
for (j = 0; j < input_buff_desc->pixels_per_row; j++) {
- gsicc_nocm_transform_general(dev, icclink, (void*) inputcolor,
- (void*) &(outputcolor[0]), num_bytes_in,
+ gsicc_nocm_transform_general(dev, icclink, (void*) inputcolor,
+ (void*) &(outputcolor[0]), num_bytes_in,
num_bytes_out);
/* Stuff the output in the proper planar location */
pos_in_short = (unsigned short*) &(outputcolor[0]);
@@ -177,8 +177,8 @@ gsicc_nocm_chunky_to_chunky(gx_device *dev, gsicc_link_t *icclink,
inputcolor = inputpos;
outputcolor = outputpos;
for (j = 0; j < input_buff_desc->pixels_per_row; j++) {
- gsicc_nocm_transform_general(dev, icclink, (void*) inputcolor,
- (void*) outputcolor, num_bytes_in,
+ gsicc_nocm_transform_general(dev, icclink, (void*) inputcolor,
+ (void*) outputcolor, num_bytes_in,
num_bytes_out);
inputcolor += pixel_in_step;
outputcolor += pixel_out_step;
@@ -188,7 +188,7 @@ gsicc_nocm_chunky_to_chunky(gx_device *dev, gsicc_link_t *icclink,
}
}
-/* Transform an entire buffer using the generic (non color managed)
+/* Transform an entire buffer using the generic (non color managed)
transformations */
static void
gsicc_nocm_transform_color_buffer(gx_device *dev, gsicc_link_t *icclink,
@@ -199,26 +199,26 @@ gsicc_nocm_transform_color_buffer(gx_device *dev, gsicc_link_t *icclink,
/* Since we have to do the mappings to and from frac colors we will for
now just call the gsicc_nocm_transform_color as we step through the
buffers. This process can be significantly sped up */
-
+
if (input_buff_desc->is_planar) {
if (output_buff_desc->is_planar) {
- gsicc_nocm_planar_to_planar(dev, icclink, input_buff_desc,
- output_buff_desc, inputbuffer,
- outputbuffer);
+ gsicc_nocm_planar_to_planar(dev, icclink, input_buff_desc,
+ output_buff_desc, inputbuffer,
+ outputbuffer);
} else {
- gsicc_nocm_planar_to_chunky(dev, icclink, input_buff_desc,
- output_buff_desc, inputbuffer,
- outputbuffer);
+ gsicc_nocm_planar_to_chunky(dev, icclink, input_buff_desc,
+ output_buff_desc, inputbuffer,
+ outputbuffer);
}
} else {
if (output_buff_desc->is_planar) {
- gsicc_nocm_chunky_to_planar(dev, icclink, input_buff_desc,
- output_buff_desc, inputbuffer,
- outputbuffer);
+ gsicc_nocm_chunky_to_planar(dev, icclink, input_buff_desc,
+ output_buff_desc, inputbuffer,
+ outputbuffer);
} else {
- gsicc_nocm_chunky_to_chunky(dev, icclink, input_buff_desc,
- output_buff_desc, inputbuffer,
- outputbuffer);
+ gsicc_nocm_chunky_to_chunky(dev, icclink, input_buff_desc,
+ output_buff_desc, inputbuffer,
+ outputbuffer);
}
}
return;
@@ -226,12 +226,12 @@ gsicc_nocm_transform_color_buffer(gx_device *dev, gsicc_link_t *icclink,
/* Shared function between the single and buffer conversions */
static void
-gsicc_nocm_transform_general(gx_device *dev, gsicc_link_t *icclink,
- void *inputcolor, void *outputcolor,
+gsicc_nocm_transform_general(gx_device *dev, gsicc_link_t *icclink,
+ void *inputcolor, void *outputcolor,
int num_bytes_in, int num_bytes_out)
{
- /* Input data is either single byte or 2 byte color values. The
- color mapping procs work on frac values so we have to sandwich
+ /* Input data is either single byte or 2 byte color values. The
+ color mapping procs work on frac values so we have to sandwich
the transformation between to and from frac conversions. We are only
doing at most 4 source colors here */
nocm_link_t *link = (nocm_link_t*) icclink->link_handle;
@@ -262,18 +262,18 @@ gsicc_nocm_transform_general(gx_device *dev, gsicc_link_t *icclink,
frac_in[2], frac_out);
break;
case 4:
- (link->cm_procs.map_cmyk)(dev, frac_in[0], frac_in[1], frac_in[2],
- frac_in[3], frac_out);
+ (link->cm_procs.map_cmyk)(dev, frac_in[0], frac_in[1], frac_in[2],
+ frac_in[3], frac_out);
break;
default:
break;
- }
+ }
if (num_bytes_out == 2) {
unsigned short *data = (unsigned short *) outputcolor;
for (k = 0; k < num_out; k++) {
data[k] = frac2ushort(frac_out[k]);
}
- } else {
+ } else {
byte *data = (byte *) outputcolor;
for (k = 0; k < num_out; k++) {
data[k] = frac2byte(frac_out[k]);
@@ -282,14 +282,14 @@ gsicc_nocm_transform_general(gx_device *dev, gsicc_link_t *icclink,
return;
}
-/* Transform a single color using the generic (non color managed)
+/* Transform a single color using the generic (non color managed)
transformations */
static void
gsicc_nocm_transform_color(gx_device *dev, gsicc_link_t *icclink, void *inputcolor,
void *outputcolor, int num_bytes)
{
- gsicc_nocm_transform_general(dev, icclink, inputcolor, outputcolor,
+ gsicc_nocm_transform_general(dev, icclink, inputcolor, outputcolor,
num_bytes, num_bytes);
}
@@ -300,11 +300,11 @@ gsicc_nocm_freelink(gsicc_link_t *icclink)
if (nocm_link->pis != NULL) {
if (nocm_link->pis->black_generation != NULL) {
- gs_free_object(nocm_link->memory, nocm_link->pis->black_generation,
+ gs_free_object(nocm_link->memory, nocm_link->pis->black_generation,
"gsicc_nocm_freelink");
}
if (nocm_link->pis->undercolor_removal != NULL) {
- gs_free_object(nocm_link->memory, nocm_link->pis->undercolor_removal,
+ gs_free_object(nocm_link->memory, nocm_link->pis->undercolor_removal,
"gsicc_nocm_freelink");
}
gs_free_object(nocm_link->memory, nocm_link->pis, "gsicc_nocm_freelink");
@@ -312,8 +312,8 @@ gsicc_nocm_freelink(gsicc_link_t *icclink)
gs_free_object(nocm_link->memory, nocm_link, "gsicc_nocm_freelink");
}
-/* Since this is the only occurence of this object we are not going to
- fool aroung with reference counting and closure functions. When
+/* Since this is the only occurence of this object we are not going to
+ fool aroung with reference counting and closure functions. When
the link is destroyed, we will simply free the bytes */
static gx_transfer_map*
gsicc_nocm_copy_curve(gx_transfer_map *in_map, gs_memory_t *mem)
@@ -323,20 +323,20 @@ gsicc_nocm_copy_curve(gx_transfer_map *in_map, gs_memory_t *mem)
if (in_map == NULL) {
return NULL;
} else {
- out_map = (gx_transfer_map*) gs_alloc_bytes(mem, sizeof(gx_transfer_map),
+ out_map = (gx_transfer_map*) gs_alloc_bytes(mem, sizeof(gx_transfer_map),
"gsicc_nocm_copy_curve");
out_map->proc = in_map->proc;
- memcpy(&(out_map->values[0]), &(in_map->values[0]),
+ memcpy(&(out_map->values[0]), &(in_map->values[0]),
sizeof(frac) * transfer_map_size);
out_map->id = gs_no_id;
return out_map;
}
}
-/* Get the link, which is the mapping procedure in this non color managed
+/* Get the link, which is the mapping procedure in this non color managed
transformation case. */
gsicc_link_t*
-gsicc_nocm_get_link(const gs_imager_state *pis, gx_device *dev,
+gsicc_nocm_get_link(const gs_imager_state *pis, gx_device *dev,
gs_color_space_index src_index)
{
gsicc_link_t *result;
@@ -367,7 +367,7 @@ gsicc_nocm_get_link(const gs_imager_state *pis, gx_device *dev,
/* We will add this to the link cache so that we can avoid the issue
of black_generation and undercolor removal being GC values.
Since the link is not GC we would need to copy the contents over
- each time a link was requested. This could be costly if we had
+ each time a link was requested. This could be costly if we had
a lot of link requests. */
hash.rend_hash = gsCMM_NONE;
hash.des_hash = dev->color_info.num_components;
@@ -379,9 +379,9 @@ gsicc_nocm_get_link(const gs_imager_state *pis, gx_device *dev,
if (result != NULL) {
return result;
}
- /* If not, then lets create a new one. This may actually return a link if
- another thread has already created it while we were trying to do so */
- if (gsicc_alloc_link_entry(pis->icc_link_cache, &result, hash, false, false))
+ /* If not, then lets create a new one. This may actually return a link if
+ another thread has already created it while we were trying to do so */
+ if (gsicc_alloc_link_entry(pis->icc_link_cache, &result, hash, false, false))
return result;
if (result == NULL)
@@ -400,20 +400,20 @@ gsicc_nocm_get_link(const gs_imager_state *pis, gx_device *dev,
result->link_handle = (void*) nocm_link;
nocm_link->memory = mem;
/* Create a dummy imager state and populate the ucr/bg values. This
- is the only part that we need */
- if (pis == NULL ||
+ is the only part that we need */
+ if (pis == NULL ||
(pis->black_generation == NULL && pis->undercolor_removal == NULL)) {
nocm_link->pis = NULL;
} else {
- nocm_link->pis = (gs_imager_state*)
- gs_alloc_bytes(mem, sizeof(gs_imager_state),
+ nocm_link->pis = (gs_imager_state*)
+ gs_alloc_bytes(mem, sizeof(gs_imager_state),
"gsicc_nocm_get_link");
nocm_link->pis->black_generation = (gx_transfer_map*)
- gsicc_nocm_copy_curve(pis->black_generation, mem);
+ gsicc_nocm_copy_curve(pis->black_generation, mem);
nocm_link->pis->undercolor_removal = (gx_transfer_map*)
- gsicc_nocm_copy_curve(pis->undercolor_removal, mem);
+ gsicc_nocm_copy_curve(pis->undercolor_removal, mem);
}
- nocm_link->num_out = min(dev->color_info.num_components,
+ nocm_link->num_out = min(dev->color_info.num_components,
GS_CLIENT_COLOR_MAX_COMPONENTS);
nocm_link->cm_procs.map_cmyk = cm_procs->map_cmyk;
nocm_link->cm_procs.map_rgb = cm_procs->map_rgb;
@@ -435,12 +435,15 @@ gsicc_nocm_get_link(const gs_imager_state *pis, gx_device *dev,
result->is_identity = false;
}
result->valid = true;
+ if (nocm_link->num_in == 4)
+ data_cs = gsCMYK;
+ else if (nocm_link->num_in == 1)
+ data_cs = gsGRAY;
+ result->data_cs = data_cs;
- /* Set up for monitoring if not gray */
+/* Set up for monitoring if not gray */
if (pageneutralcolor && nocm_link->num_in != 1) {
- if (nocm_link->num_in == 4)
- data_cs = gsCMYK;
- gsicc_mcm_set_link(result, data_cs);
+ gsicc_mcm_set_link(result);
}
/* Now release any tasks/threads waiting for these contents */
diff --git a/gs/base/gsicc_replacecm.c b/gs/base/gsicc_replacecm.c
index 346ea5b57..aeeccce48 100644
--- a/gs/base/gsicc_replacecm.c
+++ b/gs/base/gsicc_replacecm.c
@@ -400,7 +400,7 @@ gsicc_rcm_get_link(const gs_imager_state *pis, gx_device *dev,
/* Set up for monitoring non gray color spaces */
if (pageneutralcolor && data_cs != gsGRAY)
- gsicc_mcm_set_link(result, data_cs);
+ gsicc_mcm_set_link(result);
/* Now release any tasks/threads waiting for these contents */
while (result->num_waiting > 0) {
diff --git a/gs/devices/gdevpbm.c b/gs/devices/gdevpbm.c
index c3accd52b..751b7b7c7 100644
--- a/gs/devices/gdevpbm.c
+++ b/gs/devices/gdevpbm.c
@@ -291,6 +291,7 @@ static int
pnmcmyk_open(gx_device *pdev)
{
pdev->icc_struct->graydetection = true;
+ pdev->icc_struct->pageneutralcolor = true; /* enable detection */
return ppm_open(pdev);
}