diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 01979fd..de9596e 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -4404,8 +4404,6 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat #if SPLASH_CMYK pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif - setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(), - state->getOverprintMode(), state->getFillColor()); 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;