[poppler] utils/pdftoppm.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Fri Jan 16 10:59:52 PST 2015


 utils/pdftoppm.cc |   42 +++++++++++++++---------------------------
 1 file changed, 15 insertions(+), 27 deletions(-)

New commits:
commit fdba9154d9a176759c765180805e608d4959c34e
Author: Adam Reichold <adamreichold at myopera.com>
Date:   Fri Jan 16 19:57:59 2015 +0100

    pdftoppm: parse the flags earlier and only once

diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 7ff5b22..3574595 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -24,7 +24,7 @@
 // Copyright (C) 2010 Jonathan Liu <net147 at gmail.com>
 // Copyright (C) 2010 William Bader <williambader at hotmail.com>
 // Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
-// Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
+// Copyright (C) 2013, 2015 Adam Reichold <adamreichold at myopera.com>
 // Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 // Copyright (C) 2015 William Bader <williambader at hotmail.com>
 //
@@ -93,6 +93,8 @@ static GBool overprint = gFalse;
 static char enableFreeTypeStr[16] = "";
 static char antialiasStr[16] = "";
 static char vectorAntialiasStr[16] = "";
+static GBool fontAntialias = gTrue;
+static GBool vectorAntialias = gTrue;
 static char ownerPassword[33] = "";
 static char userPassword[33] = "";
 static char TiffCompressionStr[16] = "";
@@ -269,20 +271,6 @@ static std::deque<PageJob> pageJobQueue;
 static pthread_mutex_t pageJobMutex = PTHREAD_MUTEX_INITIALIZER;
 
 static void processPageJobs() {
-  GBool fontAntialias = gTrue;
-  GBool vectorAntialias = gTrue;
-
-  if (antialiasStr[0]) {
-    if (!GlobalParams::parseYesNo2(antialiasStr, &fontAntialias)) {
-      fprintf(stderr, "Bad '-aa' value on command line\n");
-    }
-  }
-  if (vectorAntialiasStr[0]) {
-    if (!GlobalParams::parseYesNo2(vectorAntialiasStr, &vectorAntialias)) {
-      fprintf(stderr, "Bad '-aaVector' value on command line\n");
-    }
-  }
-
   while(true) {
     // pop the next job or exit if queue is empty
     pthread_mutex_lock(&pageJobMutex);
@@ -345,8 +333,6 @@ int main(int argc, char *argv[]) {
   int exitCode;
   int pg, pg_num_len;
   double pg_w, pg_h, tmp;
-  GBool fontAntialias = gTrue;
-  GBool vectorAntialias = gTrue;
 
   exitCode = 99;
 
@@ -375,6 +361,17 @@ int main(int argc, char *argv[]) {
   if (argc > 1) fileName = new GooString(argv[1]);
   if (argc == 3) ppmRoot = argv[2];
 
+  if (antialiasStr[0]) {
+    if (!GlobalParams::parseYesNo2(antialiasStr, &fontAntialias)) {
+      fprintf(stderr, "Bad '-aa' value on command line\n");
+    }
+  }
+  if (vectorAntialiasStr[0]) {
+    if (!GlobalParams::parseYesNo2(vectorAntialiasStr, &vectorAntialias)) {
+      fprintf(stderr, "Bad '-aaVector' value on command line\n");
+    }
+  }
+
   // read config file
   globalParams = new GlobalParams();
   if (enableFreeTypeStr[0]) {
@@ -475,16 +472,7 @@ int main(int argc, char *argv[]) {
 				             splashModeRGB8, 4,
 				  gFalse, paperColor, gTrue, thinLineMode);
 
-  if (antialiasStr[0]) {
-    if (!GlobalParams::parseYesNo2(antialiasStr, &fontAntialias)) {
-      fprintf(stderr, "Bad '-aa' value on command line\n");
-    }
-  }
-  if (vectorAntialiasStr[0]) {
-    if (!GlobalParams::parseYesNo2(vectorAntialiasStr, &vectorAntialias)) {
-      fprintf(stderr, "Bad '-aaVector' value on command line\n");
-    }
-  }
+
 
   splashOut->setFontAntialias(fontAntialias);
   splashOut->setVectorAntialias(vectorAntialias);


More information about the poppler mailing list