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

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Oct 19 16:13:40 UTC 2017


 poppler/GlobalParams.cc |   16 ----------------
 poppler/GlobalParams.h  |    3 ---
 poppler/PSOutputDev.cc  |    3 ++-
 poppler/PSOutputDev.h   |    4 +++-
 utils/pdftops.cc        |    8 ++++----
 5 files changed, 9 insertions(+), 25 deletions(-)

New commits:
commit 88571e7877f729eec2f7a3552b0fa6cc913ae1a6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Oct 19 18:11:49 2017 +0200

    Move setPSCenter from GlobalParams to PSOutputDev

diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index e3de7e3f..1461910d 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -572,7 +572,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
   sysFonts = new SysFontList();
   psExpandSmaller = gFalse;
   psShrinkLarger = gTrue;
-  psCenter = gTrue;
   psLevel = psLevel2;
   textEncoding = new GooString("UTF-8");
 #if defined(_WIN32)
@@ -1373,15 +1372,6 @@ GBool GlobalParams::getPSShrinkLarger() {
   return f;
 }
 
-GBool GlobalParams::getPSCenter() {
-  GBool f;
-
-  lockGlobalParams;
-  f = psCenter;
-  unlockGlobalParams;
-  return f;
-}
-
 PSLevel GlobalParams::getPSLevel() {
   PSLevel level;
 
@@ -1561,12 +1551,6 @@ void GlobalParams::setPSShrinkLarger(GBool shrink) {
   unlockGlobalParams;
 }
 
-void GlobalParams::setPSCenter(GBool center) {
-  lockGlobalParams;
-  psCenter = center;
-  unlockGlobalParams;
-}
-
 void GlobalParams::setPSLevel(PSLevel level) {
   lockGlobalParams;
   psLevel = level;
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 31e8cbfa..78a70cdf 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -133,7 +133,6 @@ public:
 		              GooString *base14Name = NULL);
   GBool getPSExpandSmaller();
   GBool getPSShrinkLarger();
-  GBool getPSCenter();
   PSLevel getPSLevel();
   GooString *getTextEncodingName();
   EndOfLineKind getTextEOL();
@@ -159,7 +158,6 @@ public:
   void addFontFile(GooString *fontName, GooString *path);
   void setPSExpandSmaller(GBool expand);
   void setPSShrinkLarger(GBool shrink);
-  void setPSCenter(GBool center);
   void setPSLevel(PSLevel level);
   void setTextEncoding(char *encodingName);
   GBool setTextEOL(char *s);
@@ -219,7 +217,6 @@ private:
   SysFontList *sysFonts;	// system fonts
   GBool psExpandSmaller;	// expand smaller pages to fill paper
   GBool psShrinkLarger;		// shrink larger pages to fit paper
-  GBool psCenter;		// center pages on the paper
   PSLevel psLevel;		// PostScript level to generate
   GooString *textEncoding;	// encoding (unicodeMap) to use for text
 				//   output
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 5e4226f4..b3fffe46 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1259,6 +1259,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
   rasterMono = gFalse;
   rasterResolution = 300;
   uncompressPreloadedImages = gFalse;
+  psCenter = gTrue;
   rasterAntialias = gFalse;
   displayText = gTrue;
   ok = gTrue;
@@ -3834,7 +3835,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) {
     if (tx0 >= 0 && ty0 >= 0) {
       tx += (rotate == 0 || rotate == 180) ? tx0 : ty0;
       ty += (rotate == 0 || rotate == 180) ? ty0 : -tx0;
-    } else if (globalParams->getPSCenter()) {
+    } else if (psCenter) {
       if (clipLLX0 < clipURX0 && clipLLY0 < clipURY0) {
 	tx += (imgWidth2 - xScale * (clipURX0 - clipLLX0)) / 2;
 	ty += (imgHeight2 - yScale * (clipURY0 - clipLLY0)) / 2;
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 8dd1c950..f081414e 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2006-2008, 2012, 2013, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2008, 2012, 2013, 2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2007 Brad Hards <bradh at kde.org>
 // Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2009 Till Kamppeter <till.kamppeter at gmail.com>
@@ -309,6 +309,7 @@ public:
     { overlayCbk = cbk; overlayCbkData = data; }
   void setDisplayText(GBool display) { displayText = display; }
 
+  void setPSCenter(GBool center) { psCenter = center; }
   void setRasterAntialias(GBool a) { rasterAntialias = a; }
   void setRasterResolution(double r) { rasterResolution = r; }
   void setRasterMono(GBool b) { rasterMono = b; }
@@ -527,6 +528,7 @@ private:
   GBool t3NeedsRestore;		// set if a 'q' operator was issued
   GBool forceRasterize;		// forces the page to be rasterized into a image before printing
   GBool displayText;		// displayText
+  GBool psCenter;		// center pages on the paper
   GBool rasterAntialias;	// antialias on rasterize
   GBool uncompressPreloadedImages;
   double rasterResolution;	// PostScript rasterization resolution (dpi)
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 2eeba195..b1339f23 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -16,7 +16,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2007-2008, 2010, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2008, 2010, 2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Till Kamppeter <till.kamppeter at gmail.com>
 // Copyright (C) 2009 Sanjoy Mahajan <sanjoy at mit.edu>
 // Copyright (C) 2009, 2011, 2012, 2014-2016 William Bader <williambader at hotmail.com>
@@ -297,9 +297,6 @@ int main(int argc, char *argv[]) {
   if (noShrink) {
     globalParams->setPSShrinkLarger(gFalse);
   }
-  if (noCenter) {
-    globalParams->setPSCenter(gFalse);
-  }
   if (level1 || level1Sep || level2 || level2Sep || level3 || level3Sep) {
     globalParams->setPSLevel(level);
   }
@@ -393,6 +390,9 @@ int main(int argc, char *argv[]) {
 			  paperHeight,
                           noCrop,
 			  duplex);
+  if (noCenter) {
+    psOut->setPSCenter(gFalse);
+  }
 
   if (rasterAntialiasStr[0]) {
     if (!GlobalParams::parseYesNo2(rasterAntialiasStr, &rasterAntialias)) {


More information about the poppler mailing list