diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 01979fd..4eda348 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -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..1572b95 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -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..babd1f1 100644 --- a/splash/SplashPattern.h +++ b/splash/SplashPattern.h @@ -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;