summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorThomas Freitag <Thomas.Freitag@alfa.de>2013-12-10 20:14:39 +0100
committerAlbert Astals Cid <aacid@kde.org>2013-12-10 20:14:39 +0100
commit6c0e7d35f273583acc2aa818860e3120b0cab64f (patch)
tree19eb673d6f1ae8f0c5ae50b34ce328f6e02854dd /splash
parentf77bc21813ae7234ec4ce94ce4e92230fe5c174a (diff)
correction for knockout transparency groups
Fixes test "G" in eci_altona-test-suite-v2_technical2_x4.pdf
Diffstat (limited to 'splash')
-rw-r--r--splash/Splash.cc63
-rw-r--r--splash/SplashFTFontEngine.h3
-rw-r--r--splash/SplashFontEngine.cc13
-rw-r--r--splash/SplashFontEngine.h5
4 files changed, 68 insertions, 16 deletions
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 6bb0dfe5..4a7d814f 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -446,39 +446,68 @@ void Splash::pipeRun(SplashPipe *pipe) {
//----- read destination pixel
+ Guchar *destColorPtr;
+ if (pipe->shape && state->blendFunc && pipe->knockout && alpha0Bitmap != NULL) {
+ destColorPtr = alpha0Bitmap->data + (alpha0Y+pipe->y)*alpha0Bitmap->rowSize;
+ switch (bitmap->mode) {
+ case splashModeMono1:
+ destColorPtr += (alpha0X+pipe->x) / 8;
+ break;
+ case splashModeMono8:
+ destColorPtr += (alpha0X+pipe->x);
+ break;
+ case splashModeRGB8:
+ case splashModeBGR8:
+ destColorPtr += (alpha0X+pipe->x) * 3;
+ break;
+ case splashModeXBGR8:
+#if SPLASH_CMYK
+ case splashModeCMYK8:
+#endif
+ destColorPtr += (alpha0X+pipe->x) * 4;
+ break;
+#if SPLASH_CMYK
+ case splashModeDeviceN8:
+ destColorPtr += (alpha0X+pipe->x) * (SPOT_NCOMPS + 4);
+ break;
+#endif
+ }
+ } else {
+ destColorPtr = pipe->destColorPtr;
+ }
switch (bitmap->mode) {
case splashModeMono1:
- cDest[0] = (*pipe->destColorPtr & pipe->destColorMask) ? 0xff : 0x00;
+ cDest[0] = (*destColorPtr & pipe->destColorMask) ? 0xff : 0x00;
break;
case splashModeMono8:
- cDest[0] = *pipe->destColorPtr;
+ cDest[0] = *destColorPtr;
break;
case splashModeRGB8:
- cDest[0] = pipe->destColorPtr[0];
- cDest[1] = pipe->destColorPtr[1];
- cDest[2] = pipe->destColorPtr[2];
+ cDest[0] = destColorPtr[0];
+ cDest[1] = destColorPtr[1];
+ cDest[2] = destColorPtr[2];
break;
case splashModeXBGR8:
- cDest[0] = pipe->destColorPtr[2];
- cDest[1] = pipe->destColorPtr[1];
- cDest[2] = pipe->destColorPtr[0];
+ cDest[0] = destColorPtr[2];
+ cDest[1] = destColorPtr[1];
+ cDest[2] = destColorPtr[0];
cDest[3] = 255;
break;
case splashModeBGR8:
- cDest[0] = pipe->destColorPtr[2];
- cDest[1] = pipe->destColorPtr[1];
- cDest[2] = pipe->destColorPtr[0];
+ cDest[0] = destColorPtr[2];
+ cDest[1] = destColorPtr[1];
+ cDest[2] = destColorPtr[0];
break;
#if SPLASH_CMYK
case splashModeCMYK8:
- cDest[0] = pipe->destColorPtr[0];
- cDest[1] = pipe->destColorPtr[1];
- cDest[2] = pipe->destColorPtr[2];
- cDest[3] = pipe->destColorPtr[3];
+ cDest[0] = destColorPtr[0];
+ cDest[1] = destColorPtr[1];
+ cDest[2] = destColorPtr[2];
+ cDest[3] = destColorPtr[3];
break;
case splashModeDeviceN8:
for (cp = 0; cp < SPOT_NCOMPS + 4; cp++)
- cDest[cp] = pipe->destColorPtr[cp];
+ cDest[cp] = destColorPtr[cp];
break;
#endif
}
@@ -1549,6 +1578,7 @@ Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
thinLineMode = splashThinLineDefault;
clearModRegion();
debugMode = gFalse;
+ alpha0Bitmap = NULL;
}
Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
@@ -1576,6 +1606,7 @@ Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
thinLineMode = splashThinLineDefault;
clearModRegion();
debugMode = gFalse;
+ alpha0Bitmap = NULL;
}
Splash::~Splash() {
diff --git a/splash/SplashFTFontEngine.h b/splash/SplashFTFontEngine.h
index aa1ad5f3..11bbea74 100644
--- a/splash/SplashFTFontEngine.h
+++ b/splash/SplashFTFontEngine.h
@@ -15,6 +15,7 @@
// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
+// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@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
@@ -58,6 +59,8 @@ public:
int *codeToGID, int codeToGIDLen);
SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src,
int *codeToGID, int codeToGIDLen, int faceIndex = 0);
+ GBool getAA() { return aa; }
+ void setAA(GBool aaA) { aa = aaA; }
private:
diff --git a/splash/SplashFontEngine.cc b/splash/SplashFontEngine.cc
index 2e74f5a7..968e8207 100644
--- a/splash/SplashFontEngine.cc
+++ b/splash/SplashFontEngine.cc
@@ -16,6 +16,7 @@
// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
+// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@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
@@ -288,6 +289,18 @@ SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA,
return fontFile;
}
+#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
+GBool SplashFontEngine::getAA() {
+ return (ftEngine == NULL) ? gFalse : ftEngine->getAA();
+}
+
+void SplashFontEngine::setAA(GBool aa) {
+ if (ftEngine != NULL) {
+ ftEngine->setAA(aa);
+ }
+}
+#endif
+
SplashFont *SplashFontEngine::getFont(SplashFontFile *fontFile,
SplashCoord *textMat,
SplashCoord *ctm) {
diff --git a/splash/SplashFontEngine.h b/splash/SplashFontEngine.h
index 54926b41..6502ea5a 100644
--- a/splash/SplashFontEngine.h
+++ b/splash/SplashFontEngine.h
@@ -15,6 +15,7 @@
// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
// Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
+// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@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
@@ -89,6 +90,10 @@ public:
// Note that the Splash y axis points downward.
SplashFont *getFont(SplashFontFile *fontFile,
SplashCoord *textMat, SplashCoord *ctm);
+#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
+ GBool getAA();
+ void setAA(GBool aa);
+#endif
private: