From c8376f966de15dac704666cc7446366328ea8737 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 25 Sep 2017 17:22:48 +0100 Subject: Don't override non-default Device{Gray,RGB,CMYK} by OI. If the OutputIntent is set, we used to set Device{Gray,RGB,CMYK} (as appopriate) to match it. Don't do this if it's already been set to something other than our defaults. --- source/fitz/colorspace.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index 1692a439..4dc4b542 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -3822,16 +3822,25 @@ fz_set_default_output_intent(fz_context *ctx, fz_default_colorspaces *default_cs switch (cs->n) { case 1: - fz_drop_colorspace(ctx, default_cs->gray); - default_cs->gray = fz_keep_colorspace(ctx, cs); + if (default_cs->gray == fz_device_gray(ctx)) + { + fz_drop_colorspace(ctx, default_cs->gray); + default_cs->gray = fz_keep_colorspace(ctx, cs); + } break; case 3: - fz_drop_colorspace(ctx, default_cs->rgb); - default_cs->rgb = fz_keep_colorspace(ctx, cs); + if (default_cs->rgb == fz_device_rgb(ctx)) + { + fz_drop_colorspace(ctx, default_cs->rgb); + default_cs->rgb = fz_keep_colorspace(ctx, cs); + } break; case 4: - fz_drop_colorspace(ctx, default_cs->cmyk); - default_cs->cmyk = fz_keep_colorspace(ctx, cs); + if (default_cs->cmyk == fz_device_cmyk(ctx)) + { + fz_drop_colorspace(ctx, default_cs->cmyk); + default_cs->cmyk = fz_keep_colorspace(ctx, cs); + } break; } } -- cgit v1.2.3