[poppler] poppler/SplashOutputDev.cc poppler/SplashOutputDev.h splash/Splash.cc splash/SplashPattern.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Jul 20 15:34:21 PDT 2014
poppler/SplashOutputDev.cc | 6 ++++--
poppler/SplashOutputDev.h | 8 +++++++-
splash/Splash.cc | 24 ++++++++++++++++++++++--
splash/SplashPattern.h | 6 +++++-
4 files changed, 38 insertions(+), 6 deletions(-)
New commits:
commit c841a703c4c1750fd7ac0d04c6c3e7d4af80b8fa
Author: Albert Astals Cid <aacid at kde.org>
Date: Mon Jul 21 00:29:28 2014 +0200
Improve Overprintmode and shadings
Bug #80998
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 01979fd..cda0146 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -20,7 +20,7 @@
// Copyright (C) 2006 Scott Turner <scotty1024 at mac.com>
// Copyright (C) 2007 Koji Otani <sho at bbr.jp>
// Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
-// Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2009-2014 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc at gnome.org>
// Copyright (C) 2009 William Bader <williambader at hotmail.com>
// Copyright (C) 2010 Patrick Spendrin <ps_ml at gmx.de>
@@ -150,6 +150,7 @@ SplashGouraudPattern::SplashGouraudPattern(GBool bDirectColorTranslationA,
bDirectColorTranslation = bDirectColorTranslationA;
shadingA->getColorSpace()->getDefaultColor(&srcColor);
convertGfxColor(defaultColor, mode, shadingA->getColorSpace(), &srcColor);
+ gfxMode = shadingA->getColorSpace()->getMode();
}
SplashGouraudPattern::~SplashGouraudPattern() {
@@ -198,6 +199,7 @@ SplashUnivariatePattern::SplashUnivariatePattern(SplashColorMode colorModeA, Gfx
stateA->getUserClipBBox(&xMin, &yMin, &xMax, &yMax);
shadingA->setupCache(&ctm, xMin, yMin, xMax, yMax);
+ gfxMode = shadingA->getColorSpace()->getMode();
}
SplashUnivariatePattern::~SplashUnivariatePattern() {
@@ -4405,7 +4407,7 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat
pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
#endif
setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(),
- state->getOverprintMode(), state->getFillColor());
+ state->getOverprintMode(), NULL);
retVal = (splash->shadedFill(path, pattern->getShading()->getHasBBox(), pattern) == splashOk);
state->clearPath();
setVectorAntialias(vaa);
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index ce1d50d..efbb865 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Takashi Iwai <tiwai at suse.de>
-// Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2009-2014 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc at gnome.org>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz at gmail.com>
@@ -75,12 +75,15 @@ public:
virtual GfxUnivariateShading *getShading() { return shading; }
+ virtual GBool isCMYK() { return gfxMode == csDeviceCMYK; }
+
protected:
Matrix ictm;
double t0, t1, dt;
GfxUnivariateShading *shading;
GfxState *state;
SplashColorMode colorMode;
+ GfxColorSpaceMode gfxMode;
};
class SplashAxialPattern: public SplashUnivariatePattern {
@@ -115,6 +118,8 @@ public:
virtual GBool isStatic() { return gFalse; }
+ virtual GBool isCMYK() { return gfxMode == csDeviceCMYK; }
+
virtual GBool isParameterized() { return shading->isParameterized(); }
virtual int getNTriangles() { return shading->getNTriangles(); }
virtual void getTriangle(int i, double *x0, double *y0, double *color0,
@@ -129,6 +134,7 @@ private:
GfxState *state;
GBool bDirectColorTranslation;
SplashColorMode mode;
+ GfxColorSpaceMode gfxMode;
};
// see GfxState.h, GfxRadialShading
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 8d0765b..fde272a 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -361,9 +361,29 @@ void Splash::pipeRun(SplashPipe *pipe) {
// dynamic pattern
if (pipe->pattern) {
if (!pipe->pattern->getColor(pipe->x, pipe->y, pipe->cSrcVal)) {
- pipeIncX(pipe);
- return;
+ pipeIncX(pipe);
+ return;
}
+#if SPLASH_CMYK
+ if (bitmap->mode == splashModeCMYK8 || bitmap->mode == splashModeDeviceN8) {
+ if (state->fillOverprint && state->overprintMode && pipe->pattern->isCMYK()) {
+ Guint mask = 15;
+ if (pipe->cSrcVal[0] == 0) {
+ mask &= ~1;
+ }
+ if (pipe->cSrcVal[1] == 0) {
+ mask &= ~2;
+ }
+ if (pipe->cSrcVal[2] == 0) {
+ mask &= ~4;
+ }
+ if (pipe->cSrcVal[3] == 0) {
+ mask &= ~8;
+ }
+ state->overprintMask = mask;
+ }
+ }
+#endif
}
if (pipe->noTransparency && !state->blendFunc) {
diff --git a/splash/SplashPattern.h b/splash/SplashPattern.h
index 42c1660..e678c9e 100644
--- a/splash/SplashPattern.h
+++ b/splash/SplashPattern.h
@@ -11,7 +11,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2010, 2011 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2010, 2011, 2014 Thomas Freitag <Thomas.Freitag at alfa.de>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -52,6 +52,8 @@ public:
// value for all pixels.
virtual GBool isStatic() = 0;
+ // Returns true if this pattern colorspace is CMYK.
+ virtual GBool isCMYK() = 0;
private:
};
@@ -74,6 +76,8 @@ public:
virtual GBool isStatic() { return gTrue; }
+ virtual GBool isCMYK() { return gFalse; }
+
private:
SplashColor color;
More information about the poppler
mailing list