diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/colorspace.c | 21 |
1 files 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; } } |