summaryrefslogtreecommitdiff
path: root/source/fitz/draw-device.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-09-25 14:41:57 +0100
committerRobin Watts <robin.watts@artifex.com>2017-10-24 15:16:37 +0100
commitc153ffd054c91f4a68c5df309d2b647dad6609de (patch)
tree246ffd2f1d801fa23c1fdf0a002c73b882ae33d7 /source/fitz/draw-device.c
parent531e5939f47aae5c126f947a06327d2dfc2f4afc (diff)
downloadmupdf-c153ffd054c91f4a68c5df309d2b647dad6609de.tar.xz
More overprint fixes.
For Ghent_V3.0/030_Gray_K_black_OP_x1a.pdf and Ghent_V3.0/110_defaultcolourspace_x3.pdf.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r--source/fitz/draw-device.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 4b098d57..740f817e 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -496,7 +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;
+ int devn, devgray;
if (colorspace == NULL && model != NULL)
fz_throw(ctx, FZ_ERROR_GENERIC, "color destination requires source color");
@@ -505,9 +505,15 @@ resolve_color(fz_context *ctx, fz_overprint *op, const float *color, fz_colorspa
color_params = fz_default_color_params(ctx);
devn = fz_colorspace_is_device_n(ctx, colorspace);
+ devgray = fz_colorspace_is_device_gray(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;
+ else if (devgray)
+ {
+ /* Device Gray is additive, but seems to still be counted for overprint
+ * (see Ghent_V3.0/030_Gray_K_black_OP_x1a.pdf 030.pdf). */
+ }
/* 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. */
@@ -535,15 +541,15 @@ resolve_color(fz_context *ctx, fz_overprint *op, const float *color, fz_colorspa
}
colorbv[i] = alpha * 255;
- /* If we are overprinting, and we're plotting in cmyk and a given
- * color component is zero, then protect that component from being
- * written to. */
- if (op)
+ /* op && !devn => overpinting in cmyk or devicegray. */
+ if (op && !devn)
{
- if (!fz_colorspace_is_device_n(ctx, colorspace))
- for (i = 4; i < n; i++)
- fz_set_overprint(op, i);
- if (color_params->opm == 1 && fz_colorspace_n(ctx, colorspace) == 4)
+ /* We are overprinting, so protect all spots. */
+ for (i = 4; i < n; i++)
+ fz_set_overprint(op, i);
+ /* If OPM, then protect all components for which the color values are zero.
+ * (but only if we're in devicecmyk). */
+ if (color_params->opm == 1 && colorspace != fz_device_gray(ctx))
for (i = 0; i < n; i++)
if (colorfv[i] == 0)
fz_set_overprint(op, i);