From 2c615e5aa18c7a34118605774de70b6b65f04b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Thu, 26 Sep 2013 17:39:10 +0200 Subject: fix bug 694618 For Separation and DeviceN colorspaces, the initial color value is 1.0 for all components instead of 0.0 as for most other colorspaces. The current initialization in pdf_set_colorspace initializes for CMYK which happens to work for all non-tint colorspaces. --- source/pdf/pdf-colorspace.c | 8 ++++++++ source/pdf/pdf-interpret.c | 7 +++++++ 2 files changed, 15 insertions(+) (limited to 'source/pdf') diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c index 9ade1a71..611a187b 100644 --- a/source/pdf/pdf-colorspace.c +++ b/source/pdf/pdf-colorspace.c @@ -167,6 +167,14 @@ load_separation(pdf_document *doc, pdf_obj *array) return cs; } +int +pdf_is_tint_colorspace(fz_colorspace *cs) +{ + return cs && cs->to_rgb == separation_to_rgb; +} + +/* Indexed */ + static fz_colorspace * load_indexed(pdf_document *doc, pdf_obj *array) { diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c index b498d54d..3790578f 100644 --- a/source/pdf/pdf-interpret.c +++ b/source/pdf/pdf-interpret.c @@ -1252,6 +1252,13 @@ pdf_set_colorspace(pdf_csi *csi, int what, fz_colorspace *colorspace) mat->v[1] = 0; mat->v[2] = 0; mat->v[3] = 1; + + if (pdf_is_tint_colorspace(colorspace)) + { + int i; + for (i = 0; i < colorspace->n; i++) + mat->v[i] = 1.0f; + } } static void -- cgit v1.2.3