[poppler] CMakeLists.txt config.h.cmake .gitlab-ci.yml poppler/PSOutputDev.cc poppler/SplashOutputDev.cc poppler/SplashOutputDev.h qt5/src splash/SplashBitmap.cc splash/SplashBitmap.h splash/Splash.cc splash/Splash.h splash/SplashState.cc splash/SplashState.h splash/SplashTypes.h utils/pdftoppm.cc utils/pdftops.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Aug 24 10:24:18 UTC 2019
.gitlab-ci.yml | 2
CMakeLists.txt | 4 -
config.h.cmake | 3
poppler/PSOutputDev.cc | 2
poppler/SplashOutputDev.cc | 165 --------------------------------------------
poppler/SplashOutputDev.h | 2
qt5/src/poppler-document.cc | 4 -
qt5/src/poppler-page.cc | 10 --
splash/Splash.cc | 75 --------------------
splash/Splash.h | 13 ---
splash/SplashBitmap.cc | 20 -----
splash/SplashBitmap.h | 2
splash/SplashState.cc | 19 -----
splash/SplashState.h | 2
splash/SplashTypes.h | 21 +----
utils/pdftoppm.cc | 15 ----
utils/pdftops.cc | 6 -
17 files changed, 17 insertions(+), 348 deletions(-)
New commits:
commit 2e32545b1d2e31359775a65ef34e0385c9079126
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Aug 23 00:11:45 2019 +0200
Always enable SPLASH_CMYK
Doesn't seem to cause any speed regression and one ifdef less is code easier
to maintain
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e7804304..4a1e6f94 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -76,7 +76,7 @@ build_clazy:
- dnf -y install glibc-langpack-en curl make ninja-build openjpeg2-tools clazy clang redhat-rpm-config
script:
- mkdir -p build && cd build
- - CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DSPLASH_CMYK=ON -G Ninja ..
+ - CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -G Ninja ..
- CLAZY_CHECKS="level0,level1,level2,isempty-vs-count,qhash-with-char-pointer-key,tr-non-literal,no-non-pod-global-static" ninja
build_android:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ec53d92..c6f0a7bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,7 +61,6 @@ set(ENABLE_DCTDECODER "libjpeg" CACHE STRING "Use libjpeg for DCT streams. Possi
option(ENABLE_LIBCURL "Build libcurl based HTTP support." ON)
option(ENABLE_ZLIB "Build with zlib." ON)
option(ENABLE_ZLIB_UNCOMPRESS "Use zlib to uncompress flate streams (not totally safe)." OFF)
-option(SPLASH_CMYK "Include support for CMYK rasterization." OFF)
option(USE_FLOAT "Use single precision arithmetic in the Splash backend" OFF)
option(BUILD_SHARED_LIBS "Build poppler as a shared library" ON)
if(WIN32)
@@ -717,9 +716,6 @@ endif()
message("Building Poppler with support for:")
show_end_message("font configuration" ${font_configuration})
show_end_message_yesno("splash output" ENABLE_SPLASH)
-if(SPLASH_CMYK)
- message(" with CMYK support")
-endif()
show_end_message_yesno("cairo output" CAIRO_FOUND)
show_end_message_yesno("qt5 wrapper" ENABLE_QT5)
show_end_message_yesno("glib wrapper" ENABLE_GLIB)
diff --git a/config.h.cmake b/config.h.cmake
index c9958130..c92fc352 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -156,9 +156,6 @@
/* Support for curl based doc builder is compiled in. */
#cmakedefine POPPLER_HAS_CURL_SUPPORT 1
-/* Include support for CMYK rasterization */
-#cmakedefine SPLASH_CMYK 1
-
/* Enable word list support. */
#cmakedefine TEXTOUT_WORD_LIST 1
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 0fdc92c9..c7c1304a 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3268,14 +3268,12 @@ bool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
paperColor[0] = 0xff;
splashOut = new SplashOutputDev(splashModeMono8, 1, false,
paperColor, false);
-#ifdef SPLASH_CMYK
} else if (level == psLevel1Sep || level == psLevel2Sep ||
level == psLevel3Sep || globalParams->getOverprintPreview()) {
numComps = 4;
paperColor[0] = paperColor[1] = paperColor[2] = paperColor[3] = 0;
splashOut = new SplashOutputDev(splashModeCMYK8, 1, false,
paperColor, false);
-#endif
} else {
numComps = 3;
paperColor[0] = paperColor[1] = paperColor[2] = 0xff;
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 3d2befc2..e3fcf9cb 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -87,16 +87,12 @@ static inline void convertGfxColor(SplashColorPtr dest,
SplashColor color;
GfxGray gray;
GfxRGB rgb;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
// make gcc happy
color[0] = color[1] = color[2] = 0;
-#ifdef SPLASH_CMYK
color[3] = 0;
-#endif
switch (colorMode) {
case splashModeMono1:
case splashModeMono8:
@@ -113,7 +109,6 @@ static inline void convertGfxColor(SplashColorPtr dest,
color[1] = colToByte(rgb.g);
color[2] = colToByte(rgb.b);
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
colorSpace->getCMYK(src, &cmyk);
color[0] = colToByte(cmyk.c);
@@ -126,7 +121,6 @@ static inline void convertGfxColor(SplashColorPtr dest,
for (int i = 0; i < SPOT_NCOMPS + 4; i++)
color[i] = colToByte(deviceN.c[i]);
break;
-#endif
}
splashColorCopy(dest, color);
}
@@ -164,7 +158,6 @@ static inline void convertGfxShortColor(SplashColorPtr dest,
dest[2] = colToByte(rgb.b);
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
{
GfxCMYK cmyk;
@@ -183,7 +176,6 @@ static inline void convertGfxShortColor(SplashColorPtr dest,
dest[i] = colToByte(deviceN.c[i]);
}
break;
-#endif
}
}
@@ -205,12 +197,10 @@ void SplashGouraudPattern::getParameterizedColor(double colorinterp, SplashColor
GfxColor src;
GfxColorSpace* srcColorSpace = shading->getColorSpace();
int colorComps = 3;
-#ifdef SPLASH_CMYK
if (mode == splashModeCMYK8)
colorComps=4;
else if (mode == splashModeDeviceN8)
colorComps=4 + SPOT_NCOMPS;
-#endif
shading->getParameterizedColor(colorinterp, &src);
@@ -503,20 +493,17 @@ static void splashOutBlendMultiply(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
blend[i] = (dest[i] * src[i]) / 255;
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -524,27 +511,23 @@ static void splashOutBlendMultiply(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendScreen(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
blend[i] = dest[i] + src[i] - (dest[i] * src[i]) / 255;
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -552,21 +535,18 @@ static void splashOutBlendScreen(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendOverlay(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
blend[i] = dest[i] < 0x80
@@ -574,7 +554,6 @@ static void splashOutBlendOverlay(SplashColorPtr src, SplashColorPtr dest,
: 255 - 2 * ((255 - src[i]) * (255 - dest[i])) / 255;
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -582,27 +561,23 @@ static void splashOutBlendOverlay(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendDarken(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
blend[i] = dest[i] < src[i] ? dest[i] : src[i];
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -610,27 +585,23 @@ static void splashOutBlendDarken(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendLighten(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
blend[i] = dest[i] > src[i] ? dest[i] : src[i];
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -638,7 +609,6 @@ static void splashOutBlendLighten(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendColorDodge(SplashColorPtr src, SplashColorPtr dest,
@@ -646,14 +616,12 @@ static void splashOutBlendColorDodge(SplashColorPtr src, SplashColorPtr dest,
SplashColorMode cm) {
int i, x;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
if (src[i] == 255) {
@@ -664,7 +632,6 @@ static void splashOutBlendColorDodge(SplashColorPtr src, SplashColorPtr dest,
}
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -672,21 +639,18 @@ static void splashOutBlendColorDodge(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendColorBurn(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i, x;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
if (src[i] == 0) {
@@ -697,7 +661,6 @@ static void splashOutBlendColorBurn(SplashColorPtr src, SplashColorPtr dest,
}
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -705,21 +668,18 @@ static void splashOutBlendColorBurn(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendHardLight(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
blend[i] = src[i] < 0x80
@@ -727,7 +687,6 @@ static void splashOutBlendHardLight(SplashColorPtr src, SplashColorPtr dest,
: 255 - 2 * ((255 - dest[i]) * (255 - src[i])) / 255;
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -735,21 +694,18 @@ static void splashOutBlendHardLight(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i, x;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
if (src[i] < 0x80) {
@@ -764,7 +720,6 @@ static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest,
}
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -772,7 +727,6 @@ static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 255 - blend[i];
}
}
-#endif
}
static void splashOutBlendDifference(SplashColorPtr src, SplashColorPtr dest,
@@ -780,20 +734,17 @@ static void splashOutBlendDifference(SplashColorPtr src, SplashColorPtr dest,
SplashColorMode cm) {
int i;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
blend[i] = dest[i] < src[i] ? src[i] - dest[i] : dest[i] - src[i];
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -807,27 +758,23 @@ static void splashOutBlendDifference(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 0;
}
}
-#endif
}
static void splashOutBlendExclusion(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
int i;
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
src[i] = 255 - src[i];
}
}
-#endif
{
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
blend[i] = dest[i] + src[i] - (2 * dest[i] * src[i]) / 255;
}
}
-#ifdef SPLASH_CMYK
if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) {
for (i = 0; i < splashColorModeNComps[cm]; ++i) {
dest[i] = 255 - dest[i];
@@ -841,7 +788,6 @@ static void splashOutBlendExclusion(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 0;
}
}
-#endif
}
static int getLum(int r, int g, int b) {
@@ -938,11 +884,9 @@ static void setSat(unsigned char rIn, unsigned char gIn, unsigned char bIn, int
static void splashOutBlendHue(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
unsigned char r0, g0, b0;
-#ifdef SPLASH_CMYK
unsigned char r1, g1, b1;
int i;
SplashColor src2, dest2;
-#endif
switch (cm) {
case splashModeMono1:
@@ -959,7 +903,6 @@ static void splashOutBlendHue(SplashColorPtr src, SplashColorPtr dest,
setLum(r0, g0, b0, getLum(dest[0], dest[1], dest[2]),
&blend[0], &blend[1], &blend[2]);
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
case splashModeDeviceN8:
for (i = 0; i < 4; i++) {
@@ -981,7 +924,6 @@ static void splashOutBlendHue(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 0xff - blend[i];
}
break;
-#endif
}
}
@@ -989,11 +931,9 @@ static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend,
SplashColorMode cm) {
unsigned char r0, g0, b0;
-#ifdef SPLASH_CMYK
unsigned char r1, g1, b1;
int i;
SplashColor src2, dest2;
-#endif
switch (cm) {
case splashModeMono1:
@@ -1010,7 +950,6 @@ static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest,
setLum(r0, g0, b0, getLum(dest[0], dest[1], dest[2]),
&blend[0], &blend[1], &blend[2]);
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
case splashModeDeviceN8:
for (i = 0; i < 4; i++) {
@@ -1031,17 +970,14 @@ static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 0xff - blend[i];
}
break;
-#endif
}
}
static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
-#ifdef SPLASH_CMYK
unsigned char r, g, b;
int i;
SplashColor src2, dest2;
-#endif
switch (cm) {
case splashModeMono1:
@@ -1056,7 +992,6 @@ static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest,
setLum(src[0], src[1], src[2], getLum(dest[0], dest[1], dest[2]),
&blend[0], &blend[1], &blend[2]);
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
case splashModeDeviceN8:
for (i = 0; i < 4; i++) {
@@ -1075,18 +1010,15 @@ static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 0xff - blend[i];
}
break;
-#endif
}
}
static void splashOutBlendLuminosity(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend,
SplashColorMode cm) {
-#ifdef SPLASH_CMYK
unsigned char r, g, b;
int i;
SplashColor src2, dest2;
-#endif
switch (cm) {
case splashModeMono1:
@@ -1101,7 +1033,6 @@ static void splashOutBlendLuminosity(SplashColorPtr src, SplashColorPtr dest,
setLum(dest[0], dest[1], dest[2], getLum(src[0], src[1], src[2]),
&blend[0], &blend[1], &blend[2]);
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
case splashModeDeviceN8:
for (i = 0; i < 4; i++) {
@@ -1120,7 +1051,6 @@ static void splashOutBlendLuminosity(SplashColorPtr src, SplashColorPtr dest,
blend[i] = 0xff - blend[i];
}
break;
-#endif
}
}
@@ -1482,7 +1412,6 @@ void SplashOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) {
case splashModeBGR8:
color[0] = color[1] = color[2] = 0;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
color[0] = color[1] = color[2] = color[3] = 0;
break;
@@ -1490,7 +1419,6 @@ void SplashOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) {
for (int i = 0; i < 4 + SPOT_NCOMPS; i++)
color[i] = 0;
break;
-#endif
}
splash->setStrokePattern(new SplashSolidColor(color));
splash->setFillPattern(new SplashSolidColor(color));
@@ -1611,26 +1539,20 @@ void SplashOutputDev::updateStrokeAdjust(GfxState * /*state*/) {
}
void SplashOutputDev::updateFillColorSpace(GfxState *state) {
-#ifdef SPLASH_CMYK
if (colorMode == splashModeDeviceN8)
state->getFillColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
-#endif
}
void SplashOutputDev::updateStrokeColorSpace(GfxState *state) {
-#ifdef SPLASH_CMYK
if (colorMode == splashModeDeviceN8)
state->getStrokeColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
-#endif
}
void SplashOutputDev::updateFillColor(GfxState *state) {
GfxGray gray;
GfxRGB rgb;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
switch (colorMode) {
case splashModeMono1:
@@ -1644,7 +1566,6 @@ void SplashOutputDev::updateFillColor(GfxState *state) {
state->getFillRGB(&rgb);
splash->setFillPattern(getColor(&rgb));
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
state->getFillCMYK(&cmyk);
splash->setFillPattern(getColor(&cmyk));
@@ -1653,17 +1574,14 @@ void SplashOutputDev::updateFillColor(GfxState *state) {
state->getFillDeviceN(&deviceN);
splash->setFillPattern(getColor(&deviceN));
break;
-#endif
}
}
void SplashOutputDev::updateStrokeColor(GfxState *state) {
GfxGray gray;
GfxRGB rgb;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
switch (colorMode) {
case splashModeMono1:
@@ -1677,7 +1595,6 @@ void SplashOutputDev::updateStrokeColor(GfxState *state) {
state->getStrokeRGB(&rgb);
splash->setStrokePattern(getColor(&rgb));
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
state->getStrokeCMYK(&cmyk);
splash->setStrokePattern(getColor(&cmyk));
@@ -1686,7 +1603,6 @@ void SplashOutputDev::updateStrokeColor(GfxState *state) {
state->getStrokeDeviceN(&deviceN);
splash->setStrokePattern(getColor(&deviceN));
break;
-#endif
}
}
@@ -1720,7 +1636,6 @@ SplashPattern *SplashOutputDev::getColor(GfxRGB *rgb) {
return new SplashSolidColor(color);
}
-#ifdef SPLASH_CMYK
SplashPattern *SplashOutputDev::getColor(GfxCMYK *cmyk) {
SplashColor color;
@@ -1738,15 +1653,12 @@ SplashPattern *SplashOutputDev::getColor(GfxColor *deviceN) {
color[i] = colToByte(deviceN->c[i]);
return new SplashSolidColor(color);
}
-#endif
void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap *colorMap, const GfxColor *matteColorIn, SplashColor matteColor) {
GfxGray gray;
GfxRGB rgb;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
switch (colorMode) {
case splashModeMono1:
@@ -1768,7 +1680,6 @@ void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap
matteColor[2] = colToByte(rgb.b);
matteColor[3] = 255;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
colorMap->getColorSpace()->getCMYK(matteColorIn, &cmyk);
matteColor[0] = colToByte(cmyk.c);
@@ -1781,7 +1692,6 @@ void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
matteColor[cp] = colToByte(deviceN.c[cp]);
break;
-#endif
}
}
@@ -1790,7 +1700,6 @@ void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace,
int overprintMode,
const GfxColor *singleColor,
bool grayIndexed) {
-#ifdef SPLASH_CMYK
unsigned int mask;
GfxCMYK cmyk;
bool additive = false;
@@ -1846,7 +1755,6 @@ void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace,
mask = 0xffffffff;
}
splash->setOverprintMask(mask, additive);
-#endif
}
void SplashOutputDev::updateBlendMode(GfxState *state) {
@@ -2949,7 +2857,6 @@ bool SplashOutputDev::useIccImageSrc(void *data) {
if (colorSpace->getAlt() != nullptr && colorSpace->getAlt()->getMode() == csDeviceRGB)
return true;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
if (colorSpace->getAlt() != nullptr && colorSpace->getAlt()->getMode() == csDeviceCMYK)
return true;
@@ -2958,7 +2865,6 @@ bool SplashOutputDev::useIccImageSrc(void *data) {
if (colorSpace->getAlt() != nullptr && colorSpace->getAlt()->getMode() == csDeviceN)
return true;
break;
-#endif
}
}
@@ -2978,10 +2884,8 @@ bool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
SplashColorPtr q, col;
GfxRGB rgb;
GfxGray gray;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
int nComps, x;
if (imgData->y == imgData->height) {
@@ -2993,12 +2897,10 @@ bool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
destComps = 3;
else if (imgData->colorMode == splashModeXBGR8)
destComps = 4;
-#ifdef SPLASH_CMYK
else if (imgData->colorMode == splashModeCMYK8)
destComps = 4;
else if (imgData->colorMode == splashModeDeviceN8)
destComps = SPOT_NCOMPS + 4;
-#endif
memset(colorLine, 0, imgData->width * destComps);
return false;
}
@@ -3031,7 +2933,6 @@ bool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
*q++ = col[3];
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
for (x = 0, q = colorLine; x < imgData->width; ++x, ++p) {
col = &imgData->lookup[4 * *p];
@@ -3048,7 +2949,6 @@ bool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
*q++ = col[cp];
}
break;
-#endif
}
} else {
switch (imgData->colorMode) {
@@ -3085,7 +2985,6 @@ bool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
}
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
if (imgData->colorMap->useCMYKLine()) {
imgData->colorMap->getCMYKLine(p, (unsigned char *) colorLine, imgData->width);
@@ -3110,7 +3009,6 @@ bool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
}
}
break;
-#endif
}
}
@@ -3144,12 +3042,10 @@ bool SplashOutputDev::iccImageSrc(void *data, SplashColorPtr colorLine,
destComps = 3;
else if (imgData->colorMode == splashModeXBGR8)
destComps = 4;
-#ifdef SPLASH_CMYK
else if (imgData->colorMode == splashModeCMYK8)
destComps = 4;
else if (imgData->colorMode == splashModeDeviceN8)
destComps = SPOT_NCOMPS + 4;
-#endif
memset(colorLine, 0, imgData->width * destComps);
return false;
}
@@ -3191,7 +3087,6 @@ void SplashOutputDev::iccTransform(void *data, SplashBitmap *bitmap) {
imgData->colorMap->getRGBLine(p, colorLine, bitmap->getWidth());
memcpy(p, colorLine, nComps * bitmap->getWidth());
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
imgData->colorMap->getCMYKLine(p, colorLine, bitmap->getWidth());
memcpy(p, colorLine, nComps * bitmap->getWidth());
@@ -3200,7 +3095,6 @@ void SplashOutputDev::iccTransform(void *data, SplashBitmap *bitmap) {
imgData->colorMap->getDeviceNLine(p, colorLine, bitmap->getWidth());
memcpy(p, colorLine, nComps * bitmap->getWidth());
break;
-#endif
case splashModeXBGR8:
unsigned char *q;
unsigned char *b = p;
@@ -3233,10 +3127,8 @@ bool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine,
SplashColorPtr q, col;
GfxRGB rgb;
GfxGray gray;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
unsigned char alpha;
int nComps, x, i;
@@ -3280,7 +3172,6 @@ bool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine,
*q++ = col[2];
*q++ = 255;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
col = &imgData->lookup[4 * *p];
*q++ = col[0];
@@ -3293,7 +3184,6 @@ bool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine,
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
*q++ = col[cp];
break;
-#endif
}
*aq++ = alpha;
} else {
@@ -3312,7 +3202,6 @@ bool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine,
*q++ = colToByte(rgb.b);
if (imgData->colorMode == splashModeXBGR8) *q++ = 255;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
imgData->colorMap->getCMYK(p, &cmyk);
*q++ = colToByte(cmyk.c);
@@ -3325,7 +3214,6 @@ bool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine,
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
*q++ = colToByte(deviceN.c[cp]);
break;
-#endif
}
*aq++ = alpha;
}
@@ -3400,11 +3288,9 @@ bool SplashOutputDev::tilingBitmapSrc(void *data, SplashColorPtr colorLine,
imgData->bitmap->getPixel(x, imgData->y, col);
imgData->pattern->getColor(x, imgData->y, pat);
for (int i = 0; i < splashColorModeNComps[imgData->colorMode]; ++i) {
-#ifdef SPLASH_CMYK
if (imgData->colorMode == splashModeCMYK8 || imgData->colorMode == splashModeDeviceN8)
dest[i] = div255(pat[i] * (255 - col[0]));
else
-#endif
dest[i] = 255 - div255((255 - pat[i]) * (255 - col[0]));
}
dest += splashColorModeNComps[imgData->colorMode];
@@ -3439,11 +3325,9 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
SplashICCTransform tf;
GfxGray gray;
GfxRGB rgb;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
bool grayIndexed = false;
GfxColor deviceN;
-#endif
unsigned char pix;
int n, i;
@@ -3510,7 +3394,6 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
}
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
grayIndexed = colorMap->getColorSpace()->getMode() != csDeviceGray;
imgData.lookup = (SplashColorPtr)gmallocn(n, 4);
@@ -3541,17 +3424,11 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
imgData.lookup[(SPOT_NCOMPS+4)*i +cp] = colToByte(deviceN.c[cp]);
}
break;
-#endif
}
}
-#ifdef SPLASH_CMYK
setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(),
state->getOverprintMode(), nullptr, grayIndexed);
-#else
- setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(),
- state->getOverprintMode(), nullptr);
-#endif
if (colorMode == splashModeMono1) {
srcMode = splashModeMono8;
@@ -3595,10 +3472,8 @@ bool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine,
SplashColorPtr q, col;
GfxRGB rgb;
GfxGray gray;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
unsigned char alpha;
unsigned char *maskPtr;
int maskBit;
@@ -3644,7 +3519,6 @@ bool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine,
*q++ = col[2];
*q++ = 255;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
col = &imgData->lookup[4 * *p];
*q++ = col[0];
@@ -3657,7 +3531,6 @@ bool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine,
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
*q++ = col[cp];
break;
-#endif
}
*aq++ = alpha;
} else {
@@ -3676,7 +3549,6 @@ bool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine,
*q++ = colToByte(rgb.b);
if (imgData->colorMode == splashModeXBGR8) *q++ = 255;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
imgData->colorMap->getCMYK(p, &cmyk);
*q++ = colToByte(cmyk.c);
@@ -3689,7 +3561,6 @@ bool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine,
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
*q++ = colToByte(deviceN.c[cp]);
break;
-#endif
}
*aq++ = alpha;
}
@@ -3716,16 +3587,12 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
SplashColor maskColor;
GfxGray gray;
GfxRGB rgb;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
unsigned char pix;
int n, i;
-#ifdef SPLASH_CMYK
colorMap->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
-#endif
setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(),
state->getOverprintMode(), nullptr);
@@ -3837,7 +3704,6 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
imgData.lookup[4*i+3] = 255;
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
imgData.lookup = (SplashColorPtr)gmallocn(n, 4);
for (i = 0; i < n; ++i) {
@@ -3858,7 +3724,6 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
imgData.lookup[(SPOT_NCOMPS+4)*i + cp] = colToByte(deviceN.c[cp]);
}
break;
-#endif
}
}
@@ -3893,15 +3758,11 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */,
SplashColor maskColor;
GfxGray gray;
GfxRGB rgb;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
unsigned char pix;
-#ifdef SPLASH_CMYK
colorMap->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
-#endif
setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(),
state->getOverprintMode(), nullptr);
@@ -4030,7 +3891,6 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */,
}
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
imgData.lookup = (SplashColorPtr)gmallocn_checkoverflow(n, 4);
if (likely(imgData.lookup != nullptr)) {
@@ -4055,7 +3915,6 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */,
}
}
break;
-#endif
}
}
@@ -4094,7 +3953,7 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, const double *bbox
SplashTransparencyGroup *transpGroup;
SplashColor color;
double xMin, yMin, xMax, yMax, x, y;
- int tx, ty, w, h, i;
+ int tx, ty, w, h;
// transform the bbox
state->transform(bbox[0], bbox[1], &x, &y);
@@ -4194,12 +4053,10 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, const double *bbox
blendingColorSpace->getNComps() == 3)) {
//~ does this need to use BGR8?
colorMode = splashModeRGB8;
-#ifdef SPLASH_CMYK
} else if (blendingColorSpace->getMode() == csDeviceCMYK ||
(blendingColorSpace->getMode() == csICCBased &&
blendingColorSpace->getNComps() == 4)) {
colorMode = splashModeCMYK8;
-#endif
}
}
@@ -4226,9 +4083,7 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, const double *bbox
splash->setStrokePattern(
transpGroup->origSplash->getStrokePattern()->copy());
if (isolated) {
- for (i = 0; i < splashMaxColorComps; ++i) {
- color[i] = 0;
- }
+ splashClearColor(color);
if (colorMode == splashModeXBGR8) color[3] = 255;
splash->clear(color, 0);
} else {
@@ -4306,10 +4161,8 @@ void SplashOutputDev::setSoftMask(GfxState *state, const double *bbox,
SplashColorPtr p;
GfxGray gray;
GfxRGB rgb;
-#ifdef SPLASH_CMYK
GfxCMYK cmyk;
GfxColor deviceN;
-#endif
double lum, lum2;
int tx, ty, x, y;
@@ -4344,7 +4197,6 @@ void SplashOutputDev::setSoftMask(GfxState *state, const double *bbox,
color[2] = colToByte(rgb.b);
tSplash->compositeBackground(color);
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
transpGroupStack->blendingColorSpace->getCMYK(backdropColor, &cmyk);
color[0] = colToByte(cmyk.c);
@@ -4359,7 +4211,6 @@ void SplashOutputDev::setSoftMask(GfxState *state, const double *bbox,
color[cp] = colToByte(deviceN.c[cp]);
tSplash->compositeBackground(color);
break;
-#endif
}
delete tSplash;
}
@@ -4403,7 +4254,6 @@ void SplashOutputDev::setSoftMask(GfxState *state, const double *bbox,
(0.59 / 255.0) * color[1] +
(0.11 / 255.0) * color[2];
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
case splashModeDeviceN8:
lum = (1 - color[3] / 255.0)
@@ -4414,7 +4264,6 @@ void SplashOutputDev::setSoftMask(GfxState *state, const double *bbox,
lum = 0;
}
break;
-#endif
}
if (transferFunc) {
transferFunc->transform(&lum, &lum2);
@@ -4626,11 +4475,7 @@ bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat
splash = new Splash(bitmap, true);
if (paintType == 2) {
SplashColor clearColor;
-#ifdef SPLASH_CMYK
clearColor[0] = (colorMode == splashModeCMYK8 || colorMode == splashModeDeviceN8) ? 0x00 : 0xFF;
-#else
- clearColor[0] = 0xFF;
-#endif
splash->clear(clearColor, 0);
} else {
splash->clear(paperColor, 0);
@@ -4702,12 +4547,10 @@ bool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTrian
case splashModeRGB8:
bDirectColorTranslation = (shadingMode == csDeviceRGB);
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
case splashModeDeviceN8:
bDirectColorTranslation = (shadingMode == csDeviceCMYK);
break;
-#endif
default:
break;
}
@@ -4775,9 +4618,7 @@ bool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePatt
state->closePath();
SplashPath path = convertPath(state, state->getPath(), true);
-#ifdef SPLASH_CMYK
pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
-#endif
setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(),
state->getOverprintMode(), nullptr);
retVal = (splash->shadedFill(&path, pattern->getShading()->getHasBBox(), pattern) == splashOk);
@@ -4838,9 +4679,7 @@ bool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *sh
state->closePath();
SplashPath path = convertPath(state, state->getPath(), true);
-#ifdef SPLASH_CMYK
pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS);
-#endif
setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(),
state->getOverprintMode(), nullptr);
retVal = (splash->shadedFill(&path, pattern->getShading()->getHasBBox(), pattern) == splashOk);
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index ef95f706..72ad9f04 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -399,10 +399,8 @@ private:
void setupScreenParams(double hDPI, double vDPI);
SplashPattern *getColor(GfxGray gray);
SplashPattern *getColor(GfxRGB *rgb);
-#ifdef SPLASH_CMYK
SplashPattern *getColor(GfxCMYK *cmyk);
SplashPattern *getColor(GfxColor *deviceN);
-#endif
static void getMatteColor( SplashColorMode colorMode, GfxImageColorMap *colorMap, const GfxColor * matteColor, SplashColor splashMatteColor);
void setOverprintMask(GfxColorSpace *colorSpace, bool overprintFlag,
int overprintMode, const GfxColor *singleColor, bool grayIndexed = false);
diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc
index 81db4eaf..9443b3e2 100644
--- a/qt5/src/poppler-document.cc
+++ b/qt5/src/poppler-document.cc
@@ -863,11 +863,7 @@ namespace Poppler {
}
bool isOverprintPreviewAvailable() {
-#ifdef SPLASH_CMYK
return true;
-#else
- return false;
-#endif
}
}
diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc
index c4d00a6b..69006754 100644
--- a/qt5/src/poppler-page.cc
+++ b/qt5/src/poppler-page.cc
@@ -527,9 +527,7 @@ QImage Page::renderToImage(double xres, double yres, int xPos, int yPos, int w,
{
#if defined(HAVE_SPLASH)
SplashColor bgColor;
- bool overprintPreview = false;
-#ifdef SPLASH_CMYK
- overprintPreview = m_page->parentDoc->m_hints & Document::OverprintPreview ? true : false;
+ const bool overprintPreview = m_page->parentDoc->m_hints & Document::OverprintPreview ? true : false;
if (overprintPreview)
{
unsigned char c, m, y, k;
@@ -553,17 +551,13 @@ QImage Page::renderToImage(double xres, double yres, int xPos, int yPos, int w,
}
}
else
-#endif
{
bgColor[0] = m_page->parentDoc->paperColor.blue();
bgColor[1] = m_page->parentDoc->paperColor.green();
bgColor[2] = m_page->parentDoc->paperColor.red();
}
- SplashColorMode colorMode = splashModeXBGR8;
-#ifdef SPLASH_CMYK
- if (overprintPreview) colorMode = splashModeDeviceN8;
-#endif
+ const SplashColorMode colorMode = overprintPreview ? splashModeDeviceN8 : splashModeXBGR8;
SplashThinLineMode thinLineMode = splashThinLineDefault;
if (m_page->parentDoc->m_hints & Document::ThinLineShape) thinLineMode = splashThinLineShape;
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 074dfe6e..c3e54b84 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -169,12 +169,9 @@ SplashPipeResultColorCtrl Splash::pipeResultColorNoAlphaBlend[] = {
splashPipeResultColorNoAlphaBlendMono,
splashPipeResultColorNoAlphaBlendRGB,
splashPipeResultColorNoAlphaBlendRGB,
- splashPipeResultColorNoAlphaBlendRGB
-#ifdef SPLASH_CMYK
- ,
+ splashPipeResultColorNoAlphaBlendRGB,
splashPipeResultColorNoAlphaBlendCMYK,
splashPipeResultColorNoAlphaBlendDeviceN
-#endif
};
SplashPipeResultColorCtrl Splash::pipeResultColorAlphaNoBlend[] = {
@@ -182,12 +179,9 @@ SplashPipeResultColorCtrl Splash::pipeResultColorAlphaNoBlend[] = {
splashPipeResultColorAlphaNoBlendMono,
splashPipeResultColorAlphaNoBlendRGB,
splashPipeResultColorAlphaNoBlendRGB,
- splashPipeResultColorAlphaNoBlendRGB
-#ifdef SPLASH_CMYK
- ,
+ splashPipeResultColorAlphaNoBlendRGB,
splashPipeResultColorAlphaNoBlendCMYK,
splashPipeResultColorAlphaNoBlendDeviceN
-#endif
};
SplashPipeResultColorCtrl Splash::pipeResultColorAlphaBlend[] = {
@@ -195,12 +189,9 @@ SplashPipeResultColorCtrl Splash::pipeResultColorAlphaBlend[] = {
splashPipeResultColorAlphaBlendMono,
splashPipeResultColorAlphaBlendRGB,
splashPipeResultColorAlphaBlendRGB,
- splashPipeResultColorAlphaBlendRGB
-#ifdef SPLASH_CMYK
- ,
+ splashPipeResultColorAlphaBlendRGB,
splashPipeResultColorAlphaBlendCMYK,
splashPipeResultColorAlphaBlendDeviceN
-#endif
};
//------------------------------------------------------------------------
@@ -310,12 +301,10 @@ inline void Splash::pipeInit(SplashPipe *pipe, int x, int y,
pipe->run = &Splash::pipeRunSimpleXBGR8;
} else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleBGR8;
-#ifdef SPLASH_CMYK
} else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleCMYK8;
} else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunSimpleDeviceN8;
-#endif
}
} else if (!pipe->pattern && !pipe->noTransparency && !state->softMask &&
pipe->usesShape &&
@@ -331,12 +320,10 @@ inline void Splash::pipeInit(SplashPipe *pipe, int x, int y,
pipe->run = &Splash::pipeRunAAXBGR8;
} else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAABGR8;
-#ifdef SPLASH_CMYK
} else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAACMYK8;
} else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) {
pipe->run = &Splash::pipeRunAADeviceN8;
-#endif
}
}
}
@@ -348,10 +335,8 @@ void Splash::pipeRun(SplashPipe *pipe) {
SplashColorPtr cSrc;
unsigned char cResult0, cResult1, cResult2, cResult3;
int t;
-#ifdef SPLASH_CMYK
int cp, mask;
unsigned char cResult[SPOT_NCOMPS+4];
-#endif
//----- source color
@@ -364,7 +349,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
pipeIncX(pipe);
return;
}
-#ifdef SPLASH_CMYK
if (bitmap->mode == splashModeCMYK8 || bitmap->mode == splashModeDeviceN8) {
if (state->fillOverprint && state->overprintMode && pipe->pattern->isCMYK()) {
unsigned int overprintMask = 15;
@@ -383,7 +367,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
state->overprintMask = overprintMask;
}
}
-#endif
}
if (pipe->noTransparency && !state->blendFunc) {
@@ -422,7 +405,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive) ?
@@ -456,7 +438,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
-#endif
}
if (pipe->destAlphaPtr) {
*pipe->destAlphaPtr++ = 255;
@@ -481,16 +462,12 @@ void Splash::pipeRun(SplashPipe *pipe) {
destColorPtr += (alpha0X+pipe->x) * 3;
break;
case splashModeXBGR8:
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
-#endif
destColorPtr += (alpha0X+pipe->x) * 4;
break;
-#ifdef SPLASH_CMYK
case splashModeDeviceN8:
destColorPtr += (alpha0X+pipe->x) * (SPOT_NCOMPS + 4);
break;
-#endif
}
} else {
destColorPtr = pipe->destColorPtr;
@@ -518,7 +495,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
cDest[1] = destColorPtr[1];
cDest[2] = destColorPtr[0];
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
cDest[0] = destColorPtr[0];
cDest[1] = destColorPtr[1];
@@ -529,7 +505,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
for (cp = 0; cp < SPOT_NCOMPS + 4; cp++)
cDest[cp] = destColorPtr[cp];
break;
-#endif
}
if (pipe->destAlphaPtr) {
aDest = *pipe->destAlphaPtr;
@@ -565,7 +540,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
} else {
t = (aDest * 255) / pipe->shape - aDest;
switch (bitmap->mode) {
-#ifdef SPLASH_CMYK
case splashModeDeviceN8:
for (cp = 0; cp < SPOT_NCOMPS + 4; cp++)
cSrcNonIso[cp] = clip255(pipe->cSrc[cp] +
@@ -576,7 +550,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
cSrcNonIso[cp] = clip255(pipe->cSrc[cp] +
((pipe->cSrc[cp] - cDest[cp]) * t) / 255);
break;
-#endif
case splashModeXBGR8:
cSrcNonIso[3] = 255;
// fallthrough
@@ -606,13 +579,11 @@ void Splash::pipeRun(SplashPipe *pipe) {
//----- blend function
if (state->blendFunc) {
-#ifdef SPLASH_CMYK
if (bitmap->mode == splashModeDeviceN8) {
for (int k = 4; k < 4 + SPOT_NCOMPS; k++) {
cBlend[k] = 0;
}
}
-#endif
(*state->blendFunc)(cSrc, cDest, cBlend, bitmap->mode);
}
@@ -653,7 +624,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
cResult2 = state->rgbTransferB[div255((255 - aDest) * cSrc[2] +
aDest * cBlend[2])];
break;
-#ifdef SPLASH_CMYK
case splashPipeResultColorNoAlphaBlendCMYK:
cResult0 = state->cmykTransferC[div255((255 - aDest) * cSrc[0] +
aDest * cBlend[0])];
@@ -669,7 +639,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
cResult[cp] = state->deviceNTransfer[cp][div255((255 - aDest) * cSrc[cp] +
aDest * cBlend[cp])];
break;
-#endif
case splashPipeResultColorAlphaNoBlendMono:
if (alphaI == 0) {
@@ -693,7 +662,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
aSrc * cSrc[2]) / alphaI];
}
break;
-#ifdef SPLASH_CMYK
case splashPipeResultColorAlphaNoBlendCMYK:
if (alphaI == 0) {
cResult0 = 0;
@@ -721,7 +689,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
aSrc * cSrc[cp]) / alphaI];
}
break;
-#endif
case splashPipeResultColorAlphaBlendMono:
if (alphaI == 0) {
@@ -753,7 +720,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
alphaI];
}
break;
-#ifdef SPLASH_CMYK
case splashPipeResultColorAlphaBlendCMYK:
if (alphaI == 0) {
cResult0 = 0;
@@ -791,7 +757,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
alphaI];
}
break;
-#endif
}
//----- write destination pixel
@@ -827,7 +792,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
*pipe->destColorPtr++ = cResult1;
*pipe->destColorPtr++ = cResult0;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
if (state->overprintMask & 1) {
pipe->destColorPtr[0] = (state->overprintAdditive) ?
@@ -861,7 +825,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
}
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
-#endif
}
if (pipe->destAlphaPtr) {
*pipe->destAlphaPtr++ = aResult;
@@ -944,7 +907,6 @@ void Splash::pipeRunSimpleBGR8(SplashPipe *pipe) {
++pipe->x;
}
-#ifdef SPLASH_CMYK
// special case:
// !pipe->pattern && pipe->noTransparency && !state->blendFunc &&
// bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
@@ -993,7 +955,6 @@ void Splash::pipeRunSimpleDeviceN8(SplashPipe *pipe) {
++pipe->x;
}
-#endif
// special case:
// !pipe->pattern && !pipe->noTransparency && !state->softMask &&
@@ -1235,7 +1196,6 @@ void Splash::pipeRunAABGR8(SplashPipe *pipe) {
++pipe->x;
}
-#ifdef SPLASH_CMYK
// special case:
// !pipe->pattern && !pipe->noTransparency && !state->softMask &&
// pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc &&
@@ -1350,7 +1310,6 @@ void Splash::pipeRunAADeviceN8(SplashPipe *pipe) {
++pipe->x;
}
-#endif
inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) {
pipe->x = x;
@@ -1374,14 +1333,12 @@ inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) {
case splashModeXBGR8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x];
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x];
break;
case splashModeDeviceN8:
pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (SPOT_NCOMPS + 4) * x];
break;
-#endif
}
if (bitmap->alpha) {
pipe->destAlphaPtr = &bitmap->alpha[y * bitmap->width + x];
@@ -1419,14 +1376,12 @@ inline void Splash::pipeIncX(SplashPipe *pipe) {
case splashModeXBGR8:
pipe->destColorPtr += 4;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
pipe->destColorPtr += 4;
break;
case splashModeDeviceN8:
pipe->destColorPtr += (SPOT_NCOMPS+4);
break;
-#endif
}
if (pipe->destAlphaPtr) {
++pipe->destAlphaPtr;
@@ -1996,7 +1951,6 @@ void Splash::clear(SplashColorPtr color, unsigned char alpha) {
}
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) {
if (bitmap->rowSize < 0) {
@@ -2030,7 +1984,6 @@ void Splash::clear(SplashColorPtr color, unsigned char alpha) {
row += bitmap->rowSize;
}
break;
-#endif
}
if (bitmap->alpha) {
@@ -3733,7 +3686,6 @@ SplashError Splash::drawImage(SplashImageSource src, SplashICCTransform tf, void
ok = srcMode == splashModeBGR8;
nComps = 3;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
ok = srcMode == splashModeCMYK8;
nComps = 4;
@@ -3742,7 +3694,6 @@ SplashError Splash::drawImage(SplashImageSource src, SplashICCTransform tf, void
ok = srcMode == splashModeDeviceN8;
nComps = SPOT_NCOMPS+4;
break;
-#endif
default:
ok = false;
break;
@@ -4213,10 +4164,8 @@ void Splash::scaleImageYdXd(SplashImageSource src, void *srcData,
unsigned char *lineBuf, *alphaLineBuf;
unsigned int *pixBuf, *alphaPixBuf;
unsigned int pix0, pix1, pix2;
-#ifdef SPLASH_CMYK
unsigned int pix3;
unsigned int pix[SPOT_NCOMPS+4], cp;
-#endif
unsigned int alpha;
unsigned char *destPtr, *destAlphaPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, xxa, d, d0, d1;
@@ -4378,7 +4327,6 @@ void Splash::scaleImageYdXd(SplashImageSource src, void *srcData,
*destPtr++ = (unsigned char)pix0;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
// compute the final pixel
@@ -4421,7 +4369,6 @@ void Splash::scaleImageYdXd(SplashImageSource src, void *srcData,
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
*destPtr++ = (unsigned char)pix[cp];
break;
-#endif
case splashModeMono1: // mono1 is not allowed
@@ -4563,7 +4510,6 @@ void Splash::scaleImageYdXu(SplashImageSource src, void *srcData,
*destPtr++ = (unsigned char)pix[0];
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
for (i = 0; i < xStep; ++i) {
*destPtr++ = (unsigned char)pix[0];
@@ -4578,7 +4524,6 @@ void Splash::scaleImageYdXu(SplashImageSource src, void *srcData,
*destPtr++ = (unsigned char)pix[cp];
}
break;
-#endif
}
// process alpha
@@ -4715,7 +4660,6 @@ void Splash::scaleImageYuXd(SplashImageSource src, void *srcData,
*destPtr++ = (unsigned char)pix[0];
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
for (i = 0; i < yStep; ++i) {
destPtr = destPtr0 + (i * scaledWidth + x) * nComps;
@@ -4732,7 +4676,6 @@ void Splash::scaleImageYuXd(SplashImageSource src, void *srcData,
*destPtr++ = (unsigned char)pix[cp];
}
break;
-#endif
}
// process alpha
@@ -4868,7 +4811,6 @@ void Splash::scaleImageYuXu(SplashImageSource src, void *srcData,
}
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
for (i = 0; i < yStep; ++i) {
for (j = 0; j < xStep; ++j) {
@@ -4889,7 +4831,6 @@ void Splash::scaleImageYuXu(SplashImageSource src, void *srcData,
}
}
break;
-#endif
}
// process alpha
@@ -5029,7 +4970,6 @@ void Splash::scaleImageYuXuBilinear(SplashImageSource src, void *srcData,
*destPtr++ = (unsigned char)pix[1];
*destPtr++ = (unsigned char)pix[0];
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
*destPtr++ = (unsigned char)pix[0];
*destPtr++ = (unsigned char)pix[1];
@@ -5040,7 +4980,6 @@ void Splash::scaleImageYuXuBilinear(SplashImageSource src, void *srcData,
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
*destPtr++ = (unsigned char)pix[cp];
break;
-#endif
}
// process alpha
@@ -5356,10 +5295,8 @@ void Splash::compositeBackground(SplashColorPtr color) {
SplashColorPtr p;
unsigned char *q;
unsigned char alpha, alpha1, c, color0, color1, color2;
-#ifdef SPLASH_CMYK
unsigned char color3;
unsigned char colorsp[SPOT_NCOMPS+4], cp;
-#endif
int x, y, mask;
if (unlikely(bitmap->alpha == nullptr)) {
@@ -5458,7 +5395,6 @@ void Splash::compositeBackground(SplashColorPtr color) {
}
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
color0 = color[0];
color1 = color[1];
@@ -5511,7 +5447,6 @@ void Splash::compositeBackground(SplashColorPtr color) {
}
}
break;
-#endif
}
memset(bitmap->alpha, 255, bitmap->width * bitmap->height);
}
@@ -5567,14 +5502,12 @@ bool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading)
case splashModeXBGR8:
colorComps=4;
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
colorComps=4;
break;
case splashModeDeviceN8:
colorComps=SPOT_NCOMPS+4;
break;
-#endif
}
SplashPipe pipe;
@@ -5926,7 +5859,6 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest];
@@ -5949,7 +5881,6 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
}
break;
-#endif
}
if (bitmap->alpha) {
diff --git a/splash/Splash.h b/splash/Splash.h
index d458a273..f18d7ae9 100644
--- a/splash/Splash.h
+++ b/splash/Splash.h
@@ -58,25 +58,18 @@ typedef void (*SplashICCTransform)(void *data, SplashBitmap *bitmap);
//------------------------------------------------------------------------
enum SplashPipeResultColorCtrl {
-#ifdef SPLASH_CMYK
splashPipeResultColorNoAlphaBlendCMYK,
splashPipeResultColorNoAlphaBlendDeviceN,
-#endif
splashPipeResultColorNoAlphaBlendRGB,
splashPipeResultColorNoAlphaBlendMono,
splashPipeResultColorAlphaNoBlendMono,
splashPipeResultColorAlphaNoBlendRGB,
-#ifdef SPLASH_CMYK
splashPipeResultColorAlphaNoBlendCMYK,
splashPipeResultColorAlphaNoBlendDeviceN,
-#endif
splashPipeResultColorAlphaBlendMono,
- splashPipeResultColorAlphaBlendRGB
-#ifdef SPLASH_CMYK
- ,
+ splashPipeResultColorAlphaBlendRGB,
splashPipeResultColorAlphaBlendCMYK,
splashPipeResultColorAlphaBlendDeviceN
-#endif
};
//------------------------------------------------------------------------
@@ -297,19 +290,15 @@ private:
void pipeRunSimpleRGB8(SplashPipe *pipe);
void pipeRunSimpleXBGR8(SplashPipe *pipe);
void pipeRunSimpleBGR8(SplashPipe *pipe);
-#ifdef SPLASH_CMYK
void pipeRunSimpleCMYK8(SplashPipe *pipe);
void pipeRunSimpleDeviceN8(SplashPipe *pipe);
-#endif
void pipeRunAAMono1(SplashPipe *pipe);
void pipeRunAAMono8(SplashPipe *pipe);
void pipeRunAARGB8(SplashPipe *pipe);
void pipeRunAAXBGR8(SplashPipe *pipe);
void pipeRunAABGR8(SplashPipe *pipe);
-#ifdef SPLASH_CMYK
void pipeRunAACMYK8(SplashPipe *pipe);
void pipeRunAADeviceN8(SplashPipe *pipe);
-#endif
void pipeSetXY(SplashPipe *pipe, int x, int y);
void pipeIncX(SplashPipe *pipe);
void drawPixel(SplashPipe *pipe, int x, int y, bool noClip);
diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index d12ef46a..6b3957d7 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -89,7 +89,6 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA,
rowSize = -1;
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
if (width > 0 && width <= INT_MAX / 4) {
rowSize = width * 4;
@@ -104,7 +103,6 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA,
rowSize = -1;
}
break;
-#endif
}
if (rowSize > 0) {
rowSize += rowPad - 1;
@@ -249,14 +247,12 @@ SplashError SplashBitmap::writePNMFile(FILE *f) {
}
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
case splashModeDeviceN8:
// PNM doesn't support CMYK
error(errInternal, -1, "unsupported SplashBitmap mode");
return splashErrGeneric;
break;
-#endif
}
return splashOk;
}
@@ -310,7 +306,6 @@ void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) {
pixel[1] = p[1];
pixel[2] = p[0];
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
p = &data[y * rowSize + 4 * x];
pixel[0] = p[0];
@@ -323,7 +318,6 @@ void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) {
for (int cp = 0; cp < SPOT_NCOMPS + 4; cp++)
pixel[cp] = p[cp];
break;
-#endif
}
}
@@ -379,12 +373,10 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in
#endif
#ifdef ENABLE_LIBJPEG
- #ifdef SPLASH_CMYK
case splashFormatJpegCMYK:
writer = new JpegWriter(JpegWriter::CMYK);
setJpegParams(writer, params);
break;
- #endif
case splashFormatJpeg:
writer = new JpegWriter();
setJpegParams(writer, params);
@@ -406,12 +398,10 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in
case splashModeBGR8:
writer = new TiffWriter(TiffWriter::RGB);
break;
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
case splashModeDeviceN8:
writer = new TiffWriter(TiffWriter::CMYK);
break;
-#endif
default:
fprintf(stderr, "TiffWriter: Mode %d not supported\n", mode);
writer = new TiffWriter();
@@ -446,7 +436,6 @@ void SplashBitmap::getRGBLine(int yl, SplashColorPtr line) {
m = byteToDbl(col[1]);
y = byteToDbl(col[2]);
k = byteToDbl(col[3]);
-#ifdef SPLASH_CMYK
if (separationList->size() > 0) {
for (std::size_t i = 0; i < separationList->size(); i++) {
if (col[i+4] > 0) {
@@ -470,7 +459,6 @@ void SplashBitmap::getRGBLine(int yl, SplashColorPtr line) {
if (y > 1) y = 1;
if (k > 1) k = 1;
}
-#endif
c1 = 1 - c;
m1 = 1 - m;
y1 = 1 - y;
@@ -492,7 +480,6 @@ void SplashBitmap::getXBGRLine(int yl, SplashColorPtr line, ConversionMode conve
m = byteToDbl(col[1]);
y = byteToDbl(col[2]);
k = byteToDbl(col[3]);
-#ifdef SPLASH_CMYK
if (separationList->size() > 0) {
for (std::size_t i = 0; i < separationList->size(); i++) {
if (col[i+4] > 0) {
@@ -516,7 +503,6 @@ void SplashBitmap::getXBGRLine(int yl, SplashColorPtr line, ConversionMode conve
if (y > 1) y = 1;
if (k > 1) k = 1;
}
-#endif
c1 = 1 - c;
m1 = 1 - m;
y1 = 1 - y;
@@ -596,7 +582,6 @@ bool SplashBitmap::convertToXBGR(ConversionMode conversionMode) {
return newdata != nullptr;
}
-#ifdef SPLASH_CMYK
void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) {
SplashColor col;
@@ -636,13 +621,10 @@ void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) {
*line++ = col[3];
}
}
-#endif
SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI, SplashColorMode imageWriterFormat) {
if (mode != splashModeRGB8 && mode != splashModeMono8 && mode != splashModeMono1 && mode != splashModeXBGR8 && mode != splashModeBGR8
-#ifdef SPLASH_CMYK
&& mode != splashModeCMYK8 && mode != splashModeDeviceN8
-#endif
) {
error(errInternal, -1, "unsupported SplashBitmap mode");
return splashErrGeneric;
@@ -653,7 +635,6 @@ SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int
}
switch (mode) {
-#ifdef SPLASH_CMYK
case splashModeCMYK8:
if (writer->supportCMYK()) {
SplashColorPtr row;
@@ -704,7 +685,6 @@ SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int
delete[] row;
}
break;
-#endif
case splashModeRGB8:
{
SplashColorPtr row;
diff --git a/splash/SplashBitmap.h b/splash/SplashBitmap.h
index 8ffe15cf..3b98092f 100644
--- a/splash/SplashBitmap.h
+++ b/splash/SplashBitmap.h
@@ -98,9 +98,7 @@ public:
void getPixel(int x, int y, SplashColorPtr pixel);
void getRGBLine(int y, SplashColorPtr line);
void getXBGRLine(int y, SplashColorPtr line, ConversionMode conversionMode = conversionOpaque);
-#ifdef SPLASH_CMYK
void getCMYKLine(int y, SplashColorPtr line);
-#endif
unsigned char getAlpha(int x, int y);
// Caller takes ownership of the bitmap data. The SplashBitmap
diff --git a/splash/SplashState.cc b/splash/SplashState.cc
index 733fa0a3..9d4eb6fd 100644
--- a/splash/SplashState.cc
+++ b/splash/SplashState.cc
@@ -35,10 +35,7 @@
// number of components in each color mode
int splashColorModeNComps[] = {
- 1, 1, 3, 3, 4
-#ifdef SPLASH_CMYK
- , 4, 4 + SPOT_NCOMPS
-#endif
+ 1, 1, 3, 3, 4, 4, 4 + SPOT_NCOMPS
};
SplashState::SplashState(int width, int height, bool vectorAntialias,
@@ -80,14 +77,12 @@ SplashState::SplashState(int width, int height, bool vectorAntialias,
rgbTransferG[i] = (unsigned char)i;
rgbTransferB[i] = (unsigned char)i;
grayTransfer[i] = (unsigned char)i;
-#ifdef SPLASH_CMYK
cmykTransferC[i] = (unsigned char)i;
cmykTransferM[i] = (unsigned char)i;
cmykTransferY[i] = (unsigned char)i;
cmykTransferK[i] = (unsigned char)i;
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
deviceNTransfer[cp][i] = (unsigned char)i;
-#endif
}
overprintMask = 0xffffffff;
overprintAdditive = false;
@@ -133,14 +128,12 @@ SplashState::SplashState(int width, int height, bool vectorAntialias,
rgbTransferG[i] = (unsigned char)i;
rgbTransferB[i] = (unsigned char)i;
grayTransfer[i] = (unsigned char)i;
-#ifdef SPLASH_CMYK
cmykTransferC[i] = (unsigned char)i;
cmykTransferM[i] = (unsigned char)i;
cmykTransferY[i] = (unsigned char)i;
cmykTransferK[i] = (unsigned char)i;
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
deviceNTransfer[cp][i] = (unsigned char)i;
-#endif
}
overprintMask = 0xffffffff;
overprintAdditive = false;
@@ -184,14 +177,12 @@ SplashState::SplashState(SplashState *state) {
memcpy(rgbTransferG, state->rgbTransferG, 256);
memcpy(rgbTransferB, state->rgbTransferB, 256);
memcpy(grayTransfer, state->grayTransfer, 256);
-#ifdef SPLASH_CMYK
memcpy(cmykTransferC, state->cmykTransferC, 256);
memcpy(cmykTransferM, state->cmykTransferM, 256);
memcpy(cmykTransferY, state->cmykTransferY, 256);
memcpy(cmykTransferK, state->cmykTransferK, 256);
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
memcpy(deviceNTransfer[cp], state->deviceNTransfer[cp], 256);
-#endif
overprintMask = state->overprintMask;
overprintAdditive = state->overprintAdditive;
next = nullptr;
@@ -246,22 +237,18 @@ void SplashState::setSoftMask(SplashBitmap *softMaskA) {
void SplashState::setTransfer(unsigned char *red, unsigned char *green, unsigned char *blue,
unsigned char *gray) {
-#ifdef SPLASH_CMYK
- int i;
-
- for (i = 0; i < 256; ++i) {
+ for (int i = 0; i < 256; ++i) {
cmykTransferC[i] = 255 - rgbTransferR[255 - i];
cmykTransferM[i] = 255 - rgbTransferG[255 - i];
cmykTransferY[i] = 255 - rgbTransferB[255 - i];
cmykTransferK[i] = 255 - grayTransfer[255 - i];
}
- for (i = 0; i < 256; ++i) {
+ for (int i = 0; i < 256; ++i) {
deviceNTransfer[0][i] = 255 - rgbTransferR[255 - i];
deviceNTransfer[1][i] = 255 - rgbTransferG[255 - i];
deviceNTransfer[2][i] = 255 - rgbTransferB[255 - i];
deviceNTransfer[3][i] = 255 - grayTransfer[255 - i];
}
-#endif
memcpy(rgbTransferR, red, 256);
memcpy(rgbTransferG, green, 256);
memcpy(rgbTransferB, blue, 256);
diff --git a/splash/SplashState.h b/splash/SplashState.h
index e367f5f2..58d8338e 100644
--- a/splash/SplashState.h
+++ b/splash/SplashState.h
@@ -125,13 +125,11 @@ private:
rgbTransferG[256],
rgbTransferB[256];
unsigned char grayTransfer[256];
-#ifdef SPLASH_CMYK
unsigned char cmykTransferC[256],
cmykTransferM[256],
cmykTransferY[256],
cmykTransferK[256];
unsigned char deviceNTransfer[SPOT_NCOMPS+4][256];
-#endif
unsigned int overprintMask;
bool overprintAdditive;
diff --git a/splash/SplashTypes.h b/splash/SplashTypes.h
index deb91881..b00693fe 100644
--- a/splash/SplashTypes.h
+++ b/splash/SplashTypes.h
@@ -27,6 +27,8 @@
#ifndef SPLASHTYPES_H
#define SPLASHTYPES_H
+#include <cstddef>
+
//------------------------------------------------------------------------
// coordinates
//------------------------------------------------------------------------
@@ -59,16 +61,13 @@ enum SplashColorMode {
// RGBRGB...
splashModeBGR8, // 1 byte per component, 3 bytes per pixel:
// BGRBGR...
- splashModeXBGR8 // 1 byte per component, 4 bytes per pixel:
+ splashModeXBGR8, // 1 byte per component, 4 bytes per pixel:
// XBGRXBGR...
-#ifdef SPLASH_CMYK
- ,
splashModeCMYK8, // 1 byte per component, 4 bytes per pixel:
// CMYKCMYK...
splashModeDeviceN8 // 1 byte per component,
// 4 bytes + n bytes spot colors per pixel:
// CMYKSSSSCMYKSSSS...
-#endif
};
enum SplashThinLineMode {
@@ -82,11 +81,7 @@ enum SplashThinLineMode {
extern int splashColorModeNComps[];
// max number of components in any SplashColor
-#ifdef SPLASH_CMYK
-#define splashMaxColorComps SPOT_NCOMPS+4
-#else
-#define splashMaxColorComps 4
-#endif
+constexpr std::size_t splashMaxColorComps = SPOT_NCOMPS+4;
typedef unsigned char SplashColor[splashMaxColorComps];
typedef unsigned char *SplashColorPtr;
@@ -101,7 +96,6 @@ static inline unsigned char splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
static inline unsigned char splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
static inline unsigned char splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }
-#ifdef SPLASH_CMYK
// CMYK8
static inline unsigned char splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
static inline unsigned char splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
@@ -114,39 +108,32 @@ static inline unsigned char splashDeviceN8M(SplashColorPtr deviceN8) { return de
static inline unsigned char splashDeviceN8Y(SplashColorPtr deviceN8) { return deviceN8[2]; }
static inline unsigned char splashDeviceN8K(SplashColorPtr deviceN8) { return deviceN8[3]; }
static inline unsigned char splashDeviceN8S(SplashColorPtr deviceN8, int nSpot) { return deviceN8[4 + nSpot]; }
-#endif
static inline void splashClearColor(SplashColorPtr dest) {
dest[0] = 0;
dest[1] = 0;
dest[2] = 0;
-#ifdef SPLASH_CMYK
dest[3] = 0;
for (int i = 4; i < SPOT_NCOMPS + 4; i++)
dest[i] = 0;
-#endif
}
static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
-#ifdef SPLASH_CMYK
dest[3] = src[3];
for (int i = 4; i < SPOT_NCOMPS + 4; i++)
dest[i] = src[i];
-#endif
}
static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
dest[0] ^= src[0];
dest[1] ^= src[1];
dest[2] ^= src[2];
-#ifdef SPLASH_CMYK
dest[3] ^= src[3];
for (int i = 4; i < SPOT_NCOMPS + 4; i++)
dest[i] ^= src[i];
-#endif
}
//------------------------------------------------------------------------
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 03d416e5..48a39f78 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -97,9 +97,7 @@ static GooString jpegOpt;
static int jpegQuality = -1;
static bool jpegProgressive = false;
static bool jpegOptimize = false;
-#ifdef SPLASH_CMYK
static bool overprint = false;
-#endif
static char enableFreeTypeStr[16] = "";
static char antialiasStr[16] = "";
static char vectorAntialiasStr[16] = "";
@@ -170,17 +168,13 @@ static const ArgDesc argDesc[] = {
#ifdef ENABLE_LIBJPEG
{"-jpeg", argFlag, &jpeg, 0,
"generate a JPEG file"},
-#ifdef SPLASH_CMYK
{"-jpegcmyk",argFlag, &jpegcmyk, 0,
"generate a CMYK JPEG file"},
-#endif
{"-jpegopt", argGooString, &jpegOpt, 0,
"jpeg options, with format <opt1>=<val1>[,<optN>=<valN>]*"},
#endif
-#ifdef SPLASH_CMYK
{"-overprint",argFlag, &overprint, 0,
"enable overprint"},
-#endif
#ifdef ENABLE_LIBTIFF
{"-tiff", argFlag, &tiff, 0,
"generate a TIFF file"},
@@ -368,9 +362,7 @@ static void processPageJobs() {
// process the job
SplashOutputDev *splashOut = new SplashOutputDev(mono ? splashModeMono1 :
gray ? splashModeMono8 :
-#ifdef SPLASH_CMYK
(jpegcmyk || overprint) ? splashModeDeviceN8 :
-#endif
splashModeRGB8, 4, false, *pageJob.paperColor, true, thinLineMode);
splashOut->setFontAntialias(fontAntialias);
splashOut->setVectorAntialias(vectorAntialias);
@@ -524,14 +516,11 @@ int main(int argc, char *argv[]) {
}
// write PPM files
-#ifdef SPLASH_CMYK
if (jpegcmyk || overprint) {
globalParams->setOverprintPreview(true);
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
paperColor[cp] = 0;
- } else
-#endif
- {
+ } else {
paperColor[0] = 255;
paperColor[1] = 255;
paperColor[2] = 255;
@@ -541,9 +530,7 @@ int main(int argc, char *argv[]) {
splashOut = new SplashOutputDev(mono ? splashModeMono1 :
gray ? splashModeMono8 :
-#ifdef SPLASH_CMYK
(jpegcmyk || overprint) ? splashModeDeviceN8 :
-#endif
splashModeRGB8, 4,
false, paperColor, true, thinLineMode);
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index d3d8ffc3..00ec7892 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -114,9 +114,7 @@ static char userPassword[33] = "\001";
static bool quiet = false;
static bool printVersion = false;
static bool printHelp = false;
-#ifdef SPLASH_CMYK
static bool overprint = false;
-#endif
static const ArgDesc argDesc[] = {
{"-f", argInt, &firstPage, 0,
@@ -187,10 +185,8 @@ static const ArgDesc argDesc[] = {
"owner password (for encrypted files)"},
{"-upw", argString, userPassword, sizeof(userPassword),
"user password (for encrypted files)"},
-#ifdef SPLASH_CMYK
{"-overprint",argFlag, &overprint, 0,
"enable overprint"},
-#endif
{"-q", argFlag, &quiet, 0,
"don't print any messages or errors"},
{"-v", argFlag, &printVersion, 0,
@@ -288,11 +284,9 @@ int main(int argc, char *argv[]) {
goto err0;
}
}
-#ifdef SPLASH_CMYK
if (overprint) {
globalParams->setOverprintPreview(true);
}
-#endif
if (expand) {
globalParams->setPSExpandSmaller(true);
}
More information about the poppler
mailing list