[poppler] 3 commits - poppler/CairoOutputDev.cc poppler/CairoOutputDev.h poppler/Gfx.cc poppler/OutputDev.h poppler/PreScanOutputDev.cc poppler/PreScanOutputDev.h poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/SplashOutputDev.cc poppler/SplashOutputDev.h

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Aug 18 03:30:50 PDT 2011


 poppler/CairoOutputDev.cc   |    2 -
 poppler/CairoOutputDev.h    |    4 +-
 poppler/Gfx.cc              |    4 +-
 poppler/OutputDev.h         |    2 -
 poppler/PSOutputDev.cc      |   64 +++++++++++++++++++++++++++++++++++++++-----
 poppler/PSOutputDev.h       |   16 +++++++++--
 poppler/PreScanOutputDev.cc |    3 +-
 poppler/PreScanOutputDev.h  |    3 +-
 poppler/SplashOutputDev.cc  |    3 +-
 poppler/SplashOutputDev.h   |    3 +-
 10 files changed, 86 insertions(+), 18 deletions(-)

New commits:
commit a1093aae9f64cb6768164551d50cafaef52876c1
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Aug 18 12:30:29 2011 +0200

    Fix Adrian's (C)

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index dca8871..8387c7e 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -25,7 +25,7 @@
 // Copyright (C) 2009 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009, 2011 William Bader <williambader at hotmail.com>
 // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
-// Copyright (C) 2009, 2010 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2009-2011 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 792c4d7..a1e0a29 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -21,7 +21,8 @@
 // Copyright (C) 2009 Till Kamppeter <till.kamppeter at gmail.com>
 // Copyright (C) 2009 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009, 2011 William Bader <williambader at hotmail.com>
-// Copyright 2010 Hib Eris <hib at hiberis.nl>
+// Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
+// Copyright (C) 2011 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
diff --git a/poppler/PreScanOutputDev.cc b/poppler/PreScanOutputDev.cc
index 70a7be7..f8df6a1 100644
--- a/poppler/PreScanOutputDev.cc
+++ b/poppler/PreScanOutputDev.cc
@@ -17,6 +17,7 @@
 // Copyright (C) 2010, 2011 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2011 William Bader <williambader at hotmail.com>
 // Copyright (C) 2011 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2011 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
diff --git a/poppler/PreScanOutputDev.h b/poppler/PreScanOutputDev.h
index a72d243..464fbbf 100644
--- a/poppler/PreScanOutputDev.h
+++ b/poppler/PreScanOutputDev.h
@@ -17,6 +17,7 @@
 // Copyright (C) 2010 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2011 William Bader <williambader at hotmail.com>
 // Copyright (C) 2011 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2011 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 025fe1b..96cb3c4 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -29,6 +29,7 @@
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
 // Copyright (C) 2011 Andreas Hartmetz <ahartmetz at gmail.com>
 // Copyright (C) 2011 Andrea Canciani <ranma42 at gmail.com>
+// Copyright (C) 2011 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index c6340c3..f19c542 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -19,6 +19,7 @@
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
 // Copyright (C) 2011 Andreas Hartmetz <ahartmetz at gmail.com>
 // Copyright (C) 2011 Andrea Canciani <ranma42 at gmail.com>
+// Copyright (C) 2011 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
commit 7741b24d05f50c134cf15361d52f5df7ae3c3115
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Aug 14 22:06:22 2011 +0930

    ps: Avoid using /PatternType if only one instance of the pattern is used
    
    this optimization makes pages print faster on my LaserJet

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 89cfdbc..dca8871 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -4112,6 +4112,9 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
 				     double *mat, double *bbox,
 				     int x0, int y0, int x1, int y1,
 				     double xStep, double yStep) {
+  if (x1 - x0 == 1 && y1 - y0 == 1)
+    return gFalse; // Don't need to use patterns if only one instance of the pattern is used
+
   if (level == psLevel1 || level == psLevel1Sep) {
     return tilingPatternFillL1(state, cat, str, pmat, paintType, tilingType, resDict,
 			       mat, bbox, x0, y0, x1, y1, xStep, yStep);
commit a60e61ac64634dc59c80d8e6b0288c1269fc0154
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Aug 14 21:55:24 2011 +0930

    ps: use PS Patterns for tiling fill when PS level >= 2

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 477030a..5b93dca 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -692,7 +692,7 @@ void CairoOutputDev::eoFill(GfxState *state) {
 }
 
 GBool CairoOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
-					double *pmat, int paintType, Dict *resDict,
+					double *pmat, int paintType, int /*tilingType*/, Dict *resDict,
 					double *mat, double *bbox,
 					int x0, int y0, int x1, int y1,
 					double xStep, double yStep)
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 730a23c..809bd78 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -159,7 +159,7 @@ public:
   virtual void eoFill(GfxState *state);
   virtual void clipToStrokePath(GfxState *state);
   virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
-				  double *pmat, int paintType, Dict *resDict,
+				  double *pmat, int paintType, int tilingType, Dict *resDict,
 				  double *mat, double *bbox,
 				  int x0, int y0, int x1, int y1,
 				  double xStep, double yStep);
@@ -412,7 +412,7 @@ public:
   virtual void fill(GfxState *state) { }
   virtual void eoFill(GfxState *state) { }
   virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
-				  double *pmat, int paintType, Dict *resDict,
+				  double *pmat, int paintType, int tilingType, Dict *resDict,
 				  double *mat, double *bbox,
 				  int x0, int y0, int x1, int y1,
 				  double xStep, double yStep) { return gTrue; }
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index ca93477..94f5e55 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -2142,8 +2142,8 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat,
     m1[5] = m[5];
     if (out->useTilingPatternFill() &&
     	out->tilingPatternFill(state, catalog, tPat->getContentStream(),
-			       tPat->getMatrix(), tPat->getPaintType(), tPat->getResDict(),
-			       m1, tPat->getBBox(),
+			       tPat->getMatrix(), tPat->getPaintType(), tPat->getTilingType(),
+			       tPat->getResDict(), m1, tPat->getBBox(),
 			       xi0, yi0, xi1, yi1, xstep, ystep)) {
 	    goto restore;
     } else {
diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h
index 2e3f9ae..bf984fc 100644
--- a/poppler/OutputDev.h
+++ b/poppler/OutputDev.h
@@ -197,7 +197,7 @@ public:
   virtual void fill(GfxState * /*state*/) {}
   virtual void eoFill(GfxState * /*state*/) {}
   virtual GBool tilingPatternFill(GfxState * /*state*/, Catalog * /*cat*/, Object * /*str*/,
-				  double * /*pmat*/, int /*paintType*/, Dict * /*resDict*/,
+				  double * /*pmat*/, int /*paintType*/, int /*tilingType*/, Dict * /*resDict*/,
 				  double * /*mat*/, double * /*bbox*/,
 				  int /*x0*/, int /*y0*/, int /*x1*/, int /*y1*/,
 				  double /*xStep*/, double /*yStep*/)
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 0a3df51..89cfdbc 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -4005,11 +4005,11 @@ void PSOutputDev::eoFill(GfxState *state) {
   writePS("f*\n");
 }
 
-GBool PSOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
-				     double *pmat, int paintType, Dict *resDict,
-				     double *mat, double *bbox,
-				     int x0, int y0, int x1, int y1,
-				     double xStep, double yStep) {
+GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str,
+				       double *pmat, int paintType, int tilingType, Dict *resDict,
+				       double *mat, double *bbox,
+				       int x0, int y0, int x1, int y1,
+				       double xStep, double yStep) {
   PDFRectangle box;
   Gfx *gfx;
 
@@ -4072,6 +4072,55 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
   return gTrue;
 }
 
+GBool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str,
+				       double *pmat, int paintType, int tilingType, Dict *resDict,
+				       double *mat, double *bbox,
+				       int x0, int y0, int x1, int y1,
+				       double xStep, double yStep) {
+  PDFRectangle box;
+  Gfx *gfx;
+  double cxMin, cyMin, cxMax, cyMax;
+
+  writePS("<<\n  /PatternType 1\n");
+  writePSFmt("  /PaintType {0:d}\n", paintType);
+  writePSFmt("  /TilingType {0:d}\n", tilingType);
+  writePSFmt("  /BBox [{0:.6g} {1:.6g} {2:.6g} {3:.6g}]\n", bbox[0], bbox[1], bbox[2], bbox[3]);
+  writePSFmt("  /XStep {0:.6g}\n", xStep);
+  writePSFmt("  /YStep {0:.6g}\n", yStep);
+  writePS("  /PaintProc { \n");
+  box.x1 = bbox[0];
+  box.y1 = bbox[1];
+  box.x2 = bbox[2];
+  box.y2 = bbox[3];
+  gfx = new Gfx(xref, this, resDict, m_catalog, &box, NULL);
+  inType3Char = gTrue;
+  gfx->display(str);
+  inType3Char = gFalse;
+  delete gfx;
+  writePS("  }\n");
+  writePS(">>\n");
+  writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}]\n", pmat[0], pmat[1], pmat[2], pmat[3], pmat[4], pmat[5]);
+  writePS("makepattern setpattern\n");
+  state->getClipBBox(&cxMin, &cyMin, &cxMax, &cyMax);
+  writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} rectfill\n", cxMin, cyMin, cxMax - cxMin, cyMax - cyMin);
+
+  return gTrue;
+}
+
+GBool PSOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
+				     double *pmat, int paintType, int tilingType, Dict *resDict,
+				     double *mat, double *bbox,
+				     int x0, int y0, int x1, int y1,
+				     double xStep, double yStep) {
+  if (level == psLevel1 || level == psLevel1Sep) {
+    return tilingPatternFillL1(state, cat, str, pmat, paintType, tilingType, resDict,
+			       mat, bbox, x0, y0, x1, y1, xStep, yStep);
+  } else {
+    return tilingPatternFillL2(state, cat, str, pmat, paintType, tilingType, resDict,
+			       mat, bbox, x0, y0, x1, y1, xStep, yStep);
+  }
+}
+
 GBool PSOutputDev::functionShadedFill(GfxState *state,
 				     GfxFunctionShading *shading) {
   double x0, y0, x1, y1;
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 6b37d18..792c4d7 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -210,7 +210,7 @@ public:
   virtual void fill(GfxState *state);
   virtual void eoFill(GfxState *state);
   virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
-				  double *pmat, int paintType, Dict *resDict,
+				  double *pmat, int paintType, int tilingType, Dict *resDict,
 				  double *mat, double *bbox,
 				  int x0, int y0, int x1, int y1,
 				  double xStep, double yStep);
@@ -338,6 +338,17 @@ private:
   void dumpColorSpaceL2(GfxColorSpace *colorSpace,
 			GBool genXform, GBool updateColors,
 			GBool map01);
+  GBool tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str,
+			    double *pmat, int paintType, int tilingType, Dict *resDict,
+			    double *mat, double *bbox,
+			    int x0, int y0, int x1, int y1,
+			    double xStep, double yStep);
+  GBool tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str,
+			    double *pmat, int paintType, int tilingType, Dict *resDict,
+			    double *mat, double *bbox,
+			    int x0, int y0, int x1, int y1,
+			    double xStep, double yStep);
+
 #if OPI_SUPPORT
   void opiBegin20(GfxState *state, Dict *dict);
   void opiBegin13(GfxState *state, Dict *dict);
diff --git a/poppler/PreScanOutputDev.cc b/poppler/PreScanOutputDev.cc
index 39e8287..70a7be7 100644
--- a/poppler/PreScanOutputDev.cc
+++ b/poppler/PreScanOutputDev.cc
@@ -81,7 +81,7 @@ void PreScanOutputDev::eoFill(GfxState *state) {
 }
 
 GBool PreScanOutputDev::tilingPatternFill(GfxState *state, Catalog *catalog, Object *str,
-					double *pmat, int paintType, Dict *resDict,
+					  double *pmat, int paintType, int /*tilingType*/, Dict *resDict,
 					double *mat, double *bbox,
 					int x0, int y0, int x1, int y1,
 					double xStep, double yStep) {
diff --git a/poppler/PreScanOutputDev.h b/poppler/PreScanOutputDev.h
index d97f0f7..a72d243 100644
--- a/poppler/PreScanOutputDev.h
+++ b/poppler/PreScanOutputDev.h
@@ -80,7 +80,7 @@ public:
   virtual void fill(GfxState *state);
   virtual void eoFill(GfxState *state);
   virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str,
-				  double *pmat, int paintType, Dict *resDict,
+				  double *pmat, int paintType, int tilingType, Dict *resDict,
 				  double *mat, double *bbox,
 				  int x0, int y0, int x1, int y1,
 				  double xStep, double yStep);
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index e0683db..025fe1b 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -3775,7 +3775,7 @@ void SplashOutputDev::setFreeTypeHinting(GBool enable, GBool enableSlightHinting
 }
 
 GBool SplashOutputDev::tilingPatternFill(GfxState *state, Catalog *catalog, Object *str,
-					double *ptm, int paintType, Dict *resDict,
+					double *ptm, int paintType, int /*tilingType*/, Dict *resDict,
 					double *mat, double *bbox,
 					int x0, int y0, int x1, int y1,
 					double xStep, double yStep)
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index e44e61c..c6340c3 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -271,7 +271,7 @@ public:
   virtual void fill(GfxState *state);
   virtual void eoFill(GfxState *state);
   virtual GBool tilingPatternFill(GfxState *state, Catalog *catalog, Object *str,
-				  double *pmat, int paintType, Dict *resDict,
+				  double *pmat, int paintType, int tilingType, Dict *resDict,
 				  double *mat, double *bbox,
 				  int x0, int y0, int x1, int y1,
 				  double xStep, double yStep);


More information about the poppler mailing list