[poppler] poppler/GlobalParams.cc poppler/GlobalParams.h poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/SplashOutputDev.h utils/pdftoppm.cc utils/pdftops.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 29 14:52:45 UTC 2021


 poppler/GlobalParams.cc   |    7 -------
 poppler/GlobalParams.h    |    3 ---
 poppler/PSOutputDev.cc    |    6 +++---
 poppler/PSOutputDev.h     |    2 ++
 poppler/SplashOutputDev.h |    3 +--
 utils/pdftoppm.cc         |   11 ++++++++---
 utils/pdftops.cc          |    6 +++---
 7 files changed, 17 insertions(+), 21 deletions(-)

New commits:
commit fa14391c97b8a35844a943102c0c579964301aff
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Oct 29 16:46:11 2021 +0200

    Move another GlobalParam to the OutputDevs where it belongs

diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 5673bcdf..63b679db 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -385,7 +385,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) : popplerDataDir(cu
     nameToUnicodeText = new NameToCharCode();
     sysFonts = new SysFontList();
     textEncoding = new GooString("UTF-8");
-    overprintPreview = false;
     printCommands = false;
     profileCommands = false;
     errQuiet = false;
@@ -1215,12 +1214,6 @@ void GlobalParams::setTextEncoding(const char *encodingName)
     textEncoding = new GooString(encodingName);
 }
 
-void GlobalParams::setOverprintPreview(bool overprintPreviewA)
-{
-    globalParamsLocker();
-    overprintPreview = overprintPreviewA;
-}
-
 void GlobalParams::setPrintCommands(bool printCommandsA)
 {
     globalParamsLocker();
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 152228f3..6a19d687 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -112,7 +112,6 @@ public:
     GooString *findBase14FontFile(const GooString *base14Name, const GfxFont *font);
     GooString *findSystemFontFile(const GfxFont *font, SysFontType *type, int *fontNum, GooString *substituteFontName = nullptr, const GooString *base14Name = nullptr);
     std::string getTextEncodingName() const;
-    bool getOverprintPreview() { return overprintPreview; }
     bool getPrintCommands();
     bool getProfileCommands();
     bool getErrQuiet();
@@ -129,7 +128,6 @@ public:
     //----- functions to set parameters
     void addFontFile(const GooString *fontName, const GooString *path);
     void setTextEncoding(const char *encodingName);
-    void setOverprintPreview(bool overprintPreviewA);
     void setPrintCommands(bool printCommandsA);
     void setProfileCommands(bool profileCommandsA);
     void setErrQuiet(bool errQuietA);
@@ -177,7 +175,6 @@ private:
     SysFontList *sysFonts; // system fonts
     GooString *textEncoding; // encoding (unicodeMap) to use for text
                              //   output
-    bool overprintPreview; // enable overprint preview
     bool printCommands; // print the drawing commands
     bool profileCommands; // profile the drawing commands
     bool errQuiet; // suppress error messages?
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 39930dc1..1ae270ab 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1388,7 +1388,7 @@ void PSOutputDev::postInit()
     if (!processColorFormatSpecified) {
         if (level == psLevel1) {
             processColorFormat = splashModeMono8;
-        } else if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep || globalParams->getOverprintPreview()) {
+        } else if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep || overprintPreview) {
             processColorFormat = splashModeCMYK8;
         }
 #ifdef USE_CMS
@@ -1414,7 +1414,7 @@ void PSOutputDev::postInit()
               "Conflicting settings between LanguageLevel=psLevel1 and processColorFormat."
               " Resetting processColorFormat to MONO8.");
         processColorFormat = splashModeMono8;
-    } else if ((level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep || globalParams->getOverprintPreview()) && processColorFormat != splashModeCMYK8) {
+    } else if ((level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep || overprintPreview) && processColorFormat != splashModeCMYK8) {
         error(errConfig, -1,
               "Conflicting settings between LanguageLevel and/or overprint simulation, and processColorFormat."
               " Resetting processColorFormat to CMYK8.");
@@ -3167,7 +3167,7 @@ bool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, i
 
     // If we would not rasterize this page, we would emit the overprint code anyway for language level 2 and upwards.
     // As such it is safe to assume for a CMYK printer that it would respect the overprint operands.
-    overprint = globalParams->getOverprintPreview() || (processColorFormat == splashModeCMYK8 && level >= psLevel2);
+    overprint = overprintPreview || (processColorFormat == splashModeCMYK8 && level >= psLevel2);
 
     // set up the SplashOutputDev
     internalColorFormat = processColorFormat;
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index e127ca91..6689a603 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -305,6 +305,7 @@ public:
     void setPSCenter(bool center) { psCenter = center; }
     void setPSExpandSmaller(bool expand) { psExpandSmaller = expand; }
     void setPSShrinkLarger(bool shrink) { psShrinkLarger = shrink; }
+    void setOverprintPreview(bool overprintPreviewA) { overprintPreview = overprintPreviewA; }
     void setRasterAntialias(bool a) { rasterAntialias = a; }
     void setForceRasterize(PSForceRasterize f) { forceRasterize = f; }
     void setRasterResolution(double r) { rasterResolution = r; }
@@ -502,6 +503,7 @@ private:
     bool psCenter; // center pages on the paper
     bool psExpandSmaller = false; // expand smaller pages to fill paper
     bool psShrinkLarger = true; // shrink larger pages to fit paper
+    bool overprintPreview = false; // enable overprint preview
     bool rasterAntialias; // antialias on rasterize
     bool uncompressPreloadedImages;
     double rasterResolution; // PostScript rasterization resolution (dpi)
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index 9fc6f76e..88b13b42 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -194,8 +194,7 @@ class POPPLER_PRIVATE_EXPORT SplashOutputDev : public OutputDev
 {
 public:
     // Constructor.
-    SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, bool reverseVideoA, SplashColorPtr paperColorA, bool bitmapTopDownA = true, SplashThinLineMode thinLineMode = splashThinLineDefault,
-                    bool overprintPreviewA = globalParams->getOverprintPreview());
+    SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, bool reverseVideoA, SplashColorPtr paperColorA, bool bitmapTopDownA = true, SplashThinLineMode thinLineMode = splashThinLineDefault, bool overprintPreviewA = false);
 
     // Destructor.
     ~SplashOutputDev() override;
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index c693b31d..b6df556b 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -124,6 +124,7 @@ static int jpegQuality = -1;
 static bool jpegProgressive = false;
 static bool jpegOptimize = false;
 static bool overprint = false;
+static bool splashOverprintPreview = false;
 static char enableFreeTypeStr[16] = "";
 static bool enableFreeType = true;
 static char antialiasStr[16] = "";
@@ -368,7 +369,11 @@ static void processPageJobs()
         pthread_mutex_unlock(&pageJobMutex);
 
         // process the job
-        SplashOutputDev *splashOut = new SplashOutputDev(mono ? splashModeMono1 : gray ? splashModeMono8 : (jpegcmyk || overprint) ? splashModeDeviceN8 : splashModeRGB8, 4, false, *pageJob.paperColor, true, thinLineMode);
+        SplashOutputDev *splashOut = new SplashOutputDev(mono                              ? splashModeMono1
+                                                                 : gray                    ? splashModeMono8
+                                                                 : (jpegcmyk || overprint) ? splashModeDeviceN8
+                                                                                           : splashModeRGB8,
+                                                         4, false, *pageJob.paperColor, true, thinLineMode, splashOverprintPreview);
         splashOut->setFontAntialias(fontAntialias);
         splashOut->setVectorAntialias(vectorAntialias);
         splashOut->setEnableFreeType(enableFreeType);
@@ -535,7 +540,7 @@ int main(int argc, char *argv[])
 
     // write PPM files
     if (jpegcmyk || overprint) {
-        globalParams->setOverprintPreview(true);
+        splashOverprintPreview = true;
         splashClearColor(paperColor);
     } else {
         paperColor[0] = 255;
@@ -595,7 +600,7 @@ int main(int argc, char *argv[])
 
 #ifndef UTILS_USE_PTHREADS
 
-    splashOut = new SplashOutputDev(mono ? splashModeMono1 : gray ? splashModeMono8 : (jpegcmyk || overprint) ? splashModeDeviceN8 : splashModeRGB8, 4, false, paperColor, true, thinLineMode);
+    splashOut = new SplashOutputDev(mono ? splashModeMono1 : gray ? splashModeMono8 : (jpegcmyk || overprint) ? splashModeDeviceN8 : splashModeRGB8, 4, false, paperColor, true, thinLineMode, splashOverprintPreview);
 
     splashOut->setFontAntialias(fontAntialias);
     splashOut->setVectorAntialias(vectorAntialias);
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 6d5ecc83..4813a975 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -268,9 +268,6 @@ int main(int argc, char *argv[])
             goto err0;
         }
     }
-    if (overprint) {
-        globalParams->setOverprintPreview(true);
-    }
     if (quiet) {
         globalParams->setErrQuiet(quiet);
     }
@@ -451,6 +448,9 @@ int main(int argc, char *argv[])
     if (noShrink) {
         psOut->setPSShrinkLarger(false);
     }
+    if (overprint) {
+        psOut->setOverprintPreview(true);
+    }
 
     if (rasterAntialiasStr[0]) {
         if (!GlobalParams::parseYesNo2(rasterAntialiasStr, &rasterAntialias)) {


More information about the poppler mailing list