[poppler] poppler/GfxState.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Sep 29 12:43:07 PDT 2014


 poppler/GfxState.cc |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit c54f6aceed983a221d88ce5c21becbf8aab2931b
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Mon Sep 29 21:42:46 2014 +0200

    use alt colorspace to get CMYK values for an ICC based CMYK colorspace
    
    The reason for the pale image is that GfxICCBasedColorSpace::getCMYK() uses the cms transformation to get RGB values and the convert it back to CMYK even for a ICC based CMYK colorspace instead of just returning the CMYK values itself.
    
    Bug #79019

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index eb11777..eae85dc 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -18,7 +18,7 @@
 // Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2006-2014 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009, 2012 Koji Otani <sho at bbr.jp>
-// Copyright (C) 2009, 2011-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2009, 2011-2014 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2009 Christian Persch <chpe at gnome.org>
 // Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha at gmail.com>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
@@ -2189,7 +2189,7 @@ void GfxICCBasedColorSpace::getCMYKLine(Guchar *in, Guchar *out, int length) {
 #ifdef USE_CMS
   if (lineTransform != NULL && lineTransform->getTransformPixelType() == PT_CMYK) {
     transform->doTransform(in,out,length);
-  } else if (lineTransform != NULL) {
+  } else if (lineTransform != NULL && nComps != 4) {
     GfxColorComp c, m, y, k;
     Guchar* tmp = (Guchar *)gmallocn(3 * length, sizeof(Guchar));
     getRGBLine(in, tmp, length);
@@ -2232,7 +2232,7 @@ void GfxICCBasedColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length)
         *out++ = 0;
     }
     gfree(tmp);
-  } else if (lineTransform != NULL) {
+  } else if (lineTransform != NULL && nComps != 4) {
     GfxColorComp c, m, y, k;
     Guchar* tmp = (Guchar *)gmallocn(3 * length, sizeof(Guchar));
     getRGBLine(in, tmp, length);
@@ -2302,7 +2302,7 @@ void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
       unsigned int value = (out[0] << 24) + (out[1] << 16) + (out[2] << 8) + out[3];
       cmsCache.insert(std::pair<unsigned int, unsigned int>(key, value));
     }
-  } else {
+  } else if (nComps != 4 && transform != NULL && transform->getTransformPixelType() == PT_RGB) {
     GfxRGB rgb;
     GfxColorComp c, m, y, k;
 
@@ -2321,6 +2321,8 @@ void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
     cmyk->m = m - k;
     cmyk->y = y - k;
     cmyk->k = k;
+  } else {
+    alt->getCMYK(color, cmyk);
   }
 #else
   alt->getCMYK(color, cmyk);


More information about the poppler mailing list