summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-09-21 18:22:48 +0100
committerRobin Watts <robin.watts@artifex.com>2017-10-24 15:16:37 +0100
commit41c8f19eb3e9cc422b77755882c0a1bfeeb85530 (patch)
tree36062a122f452ce1d0f1c446d89a37ad5b62e37f /source
parentabd4c0da5d50cc5b81e430dea3eaa01502370dad (diff)
downloadmupdf-41c8f19eb3e9cc422b77755882c0a1bfeeb85530.tar.xz
Disallow overprinting if CMYK spaces mismatch.
Testing tests/Ghent_V3.0/132_ICCbasedOverPrint.pdf shows that we were incorrectly allowing performing the overprint magic in the case where we were rendering to a CMYK pixmap in a different CMYK space. This is not allowed.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/draw-device.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 8adef1a3..4b098d57 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -496,6 +496,7 @@ resolve_color(fz_context *ctx, fz_overprint *op, const float *color, fz_colorspa
int i;
int n = dest->n - dest->alpha;
fz_colorspace *model = dest->colorspace;
+ int devn;
if (colorspace == NULL && model != NULL)
fz_throw(ctx, FZ_ERROR_GENERIC, "color destination requires source color");
@@ -503,12 +504,19 @@ resolve_color(fz_context *ctx, fz_overprint *op, const float *color, fz_colorspa
if (color_params == NULL)
color_params = fz_default_color_params(ctx);
+ devn = fz_colorspace_is_device_n(ctx, colorspace);
+ /* We can only overprint when enabled, and when we are in a subtractive colorspace */
if (!color_params || color_params->op == 0 || !fz_colorspace_is_subtractive(ctx, dest->colorspace))
op = NULL;
+ /* If we are in a CMYK space (i.e. not a devn one, given we know we are subtractive at this point),
+ * then we only overprint if it's the same space as the destination. */
+ /* FIXME: Possibly we need a better equivalency test here. */
+ else if (!devn && colorspace != dest->colorspace)
+ op = NULL;
if (n == 0)
i = 0;
- else if (fz_colorspace_is_device_n(ctx, colorspace) && colors_supported(ctx, colorspace, dest))
+ else if (devn && colors_supported(ctx, colorspace, dest))
{
fz_convert_separation_colors(ctx, color_params, dest->colorspace, dest->seps, colorfv, colorspace, color);
for (i = 0; i < n; i++)