The patch restores the forceRasterize argument in PSOutputDev ctors.
Commit 6ee907f291427b8751a872b31210bf32e8d2b722 had removed it, turning it
into a global param.
As a side effect, this patch also fixes qt4/poppler-ps-converter, which had
not been updated to the new signature, and thus produced corrupted output if
forceRasterization was set.
                                          
From b15e10da280e4ba3aeb6a2015c77e1c6854a49ef Mon Sep 17 00:00:00 2001
From: Fabio D'Urso <[email protected]>
Date: Mon, 26 Mar 2012 19:28:55 +0200
Subject: [PATCH] =?UTF-8?q?Re-added=20forceRasterize=20to=20PSOutputDev=20(a?=
 =?UTF-8?q?nd=20qt4=20fix=20too)=E2=80=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The patch restores the forceRasterize argument in PSOutputDev ctors.
Commit 6ee907f291427b8751a872b31210bf32e8d2b722 had removed it, turning it
into a global param.
As a side effect, this patch also fixes qt4/poppler-ps-converter, which had
not been updated to the new signature, and thus produced corrupted output if
forceRasterization was set.
---
 glib/poppler-page.cc    |    2 +-
 poppler/GlobalParams.cc |   16 ----------------
 poppler/GlobalParams.h  |    3 ---
 poppler/PSOutputDev.cc  |    6 +++++-
 poppler/PSOutputDev.h   |    3 +++
 5 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 64a65bd..c5252aa 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1065,7 +1065,7 @@ poppler_page_render_to_ps (PopplerPage   *page,
                                     ps_file->first_page, ps_file->last_page,
                                     psModePS, (int)ps_file->paper_width,
                                     (int)ps_file->paper_height, ps_file->duplex,
-                                    0, 0, 0, 0, gFalse);
+                                    0, 0, 0, 0, gFalse, gFalse);
 
 
   ps_file->document->doc->displayPage (ps_file->out, page->index + 1, 72.0, 72.0,
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 73a9855..76da74a 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -588,7 +588,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
   psUncompressPreloadedImages = gFalse;
   psRasterResolution = 300;
   psRasterMono = gFalse;
-  psAlwaysRasterize = gFalse;
   textEncoding = new GooString("UTF-8");
 #if defined(_WIN32)
   textEOL = eolDOS;
@@ -1618,15 +1617,6 @@ GBool GlobalParams::getPSRasterMono() {
   return mono;
 }
 
-GBool GlobalParams::getPSAlwaysRasterize() {
-  GBool rast;
-
-  lockGlobalParams;
-  rast = psAlwaysRasterize;
-  unlockGlobalParams;
-  return rast;
-}
-
 GooString *GlobalParams::getTextEncodingName() {
   GooString *s;
 
@@ -2016,12 +2006,6 @@ void GlobalParams::setPSRasterMono(GBool mono) {
   unlockGlobalParams;
 }
 
-void GlobalParams::setPSAlwaysRasterize(GBool always) {
-  lockGlobalParams;
-  psAlwaysRasterize = always;
-  unlockGlobalParams;
-}
-
 void GlobalParams::setTextEncoding(char *encodingName) {
   lockGlobalParams;
   delete textEncoding;
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index be1d4b6..be14123 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -170,7 +170,6 @@ public:
   GBool getPSUncompressPreloadedImages();
   double getPSRasterResolution();
   GBool getPSRasterMono();
-  GBool getPSAlwaysRasterize();
   GooString *getTextEncodingName();
   EndOfLineKind getTextEOL();
   GBool getTextPageBreaks();
@@ -225,7 +224,6 @@ public:
   void setPSUncompressPreloadedImages(GBool uncomp);
   void setPSRasterResolution(double res);
   void setPSRasterMono(GBool mono);
-  void setPSAlwaysRasterize(GBool always);
   void setTextEncoding(char *encodingName);
   GBool setTextEOL(char *s);
   void setTextPageBreaks(GBool pageBreaks);
@@ -327,7 +325,6 @@ private:
   GBool psRasterMono;		// true to do PostScript rasterization
 				//   in monochrome (gray); false to do it
 				//   in color (RGB/CMYK)
-  GBool psAlwaysRasterize;	// force PostScript rasterization
   GooString *textEncoding;	// encoding (unicodeMap) to use for text
 				//   output
   EndOfLineKind textEOL;	// type of EOL marker to use for text
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index f30f53e..8fa8410 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1052,6 +1052,7 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc,
 			 int firstPage, int lastPage, PSOutMode modeA,
 			 int paperWidthA, int paperHeightA, GBool duplexA,
 			 int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
+			 GBool forceRasterizeA,
 			 GBool manualCtrlA,
 			 PSOutCustomCodeCbk customCodeCbkA,
 			 void *customCodeCbkDataA) {
@@ -1078,6 +1079,7 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc,
   customColors = NULL;
   haveTextClip = gFalse;
   t3String = NULL;
+  forceRasterize = forceRasterizeA;
 
   // open file or pipe
   if (!strcmp(fileName, "-")) {
@@ -1120,6 +1122,7 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
 			 int firstPage, int lastPage, PSOutMode modeA,
 			 int paperWidthA, int paperHeightA, GBool duplexA,
 			 int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
+			 GBool forceRasterizeA,
 			 GBool manualCtrlA,
 			 PSOutCustomCodeCbk customCodeCbkA,
 			 void *customCodeCbkDataA) {
@@ -1143,6 +1146,7 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
   customColors = NULL;
   haveTextClip = gFalse;
   t3String = NULL;
+  forceRasterize = forceRasterizeA;
 
   init(outputFuncA, outputStreamA, psGeneric, psTitle,
        doc, firstPage, lastPage, modeA,
@@ -3055,7 +3059,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
   GBool useBinary;
   GBool isGray;
 
-  if (globalParams->getPSAlwaysRasterize()) {
+  if (forceRasterize) {
     rasterize = gTrue;
   } else {
     scan = new PreScanOutputDev(doc);
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index ed23c5c..82f8dfa 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -98,6 +98,7 @@ public:
 	      GBool duplexA = gTrue,
 	      int imgLLXA = 0, int imgLLYA = 0,
 	      int imgURXA = 0, int imgURYA = 0,
+	      GBool forceRasterizeA = gFalse,
 	      GBool manualCtrlA = gFalse,
 	      PSOutCustomCodeCbk customCodeCbkA = NULL,
 	      void *customCodeCbkDataA = NULL);
@@ -111,6 +112,7 @@ public:
 	      GBool duplexA = gTrue,
 	      int imgLLXA = 0, int imgLLYA = 0,
 	      int imgURXA = 0, int imgURYA = 0,
+	      GBool forceRasterizeA = gFalse,
 	      GBool manualCtrlA = gFalse,
 	      PSOutCustomCodeCbk customCodeCbkA = NULL,
 	      void *customCodeCbkDataA = NULL);
@@ -474,6 +476,7 @@ private:
   GBool t3FillColorOnly;	// operators should only use the fill color
   GBool t3Cacheable;		// cleared if char is not cacheable
   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
 
 #if OPI_SUPPORT
-- 
1.7.6.5

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to