[poppler] Branch 'xpdf303merge' - 2 commits - poppler/Page.cc poppler/Page.h

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Thu Sep 8 06:41:54 PDT 2011


 poppler/Page.cc |   20 ++++++++++++--------
 poppler/Page.h  |    3 +++
 2 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 3a1988db40def1655ec638cd521ed40eadc0acca
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Thu Sep 8 15:40:12 2011 +0200

    xpdf303: empty pages need to call dump to do any setup required by the OutputDev

diff --git a/poppler/Page.cc b/poppler/Page.cc
index 63171e2..1052acc 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -486,6 +486,10 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI,
     gfx->saveState();
     gfx->display(&obj);
     gfx->restoreState();
+  } else {
+    // empty pages need to call dump to do any setup required by the
+    // OutputDev
+    out->dump();
   }
   obj.free();
 
commit 4cddaed21592ac491519a81a003035bc4e618705
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Thu Sep 8 15:35:33 2011 +0200

    xpdf303: Don't clip the other page boxes to the MediaBox at the intermediate nodes
    
    only do it at the leaf (Page) nodes - the other boxes can be specified
    before the MediaBox is specified.
    I think we already had that change, we checked isPage before clipping,
    I've merged this way just to make future merges a bit easier.

diff --git a/poppler/Page.cc b/poppler/Page.cc
index 2650d5c..63171e2 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -149,14 +149,6 @@ PageAttrs::PageAttrs(PageAttrs *attrs, Dict *dict) {
   artBox = cropBox;
   readBox(dict, "ArtBox", &artBox);
 
-  if (isPage) {
-    // clip all other boxes to the media box
-    cropBox.clipTo(&mediaBox);
-    bleedBox.clipTo(&mediaBox);
-    trimBox.clipTo(&mediaBox);
-    artBox.clipTo(&mediaBox);
-  }
-
   // rotate
   dict->lookup("Rotate", &obj1);
   if (obj1.isInt()) {
@@ -197,6 +189,13 @@ PageAttrs::~PageAttrs() {
   resources.free();
 }
 
+void PageAttrs::clipBoxes() {
+  cropBox.clipTo(&mediaBox);
+  bleedBox.clipTo(&mediaBox);
+  trimBox.clipTo(&mediaBox);
+  artBox.clipTo(&mediaBox);
+}
+
 GBool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) {
   PDFRectangle tmp;
   double t;
@@ -271,6 +270,7 @@ Page::Page(PDFDoc *docA, int numA, Dict *pageDict, Ref pageRefA, PageAttrs *attr
 
   // get attributes
   attrs = attrsA;
+  attrs->clipBoxes();
 
   // transtion
   pageDict->lookupNF("Trans", &trans);
diff --git a/poppler/Page.h b/poppler/Page.h
index c5ff8d7..593bea0 100644
--- a/poppler/Page.h
+++ b/poppler/Page.h
@@ -99,6 +99,9 @@ public:
   Dict *getResourceDict()
     { return resources.isDict() ? resources.getDict() : (Dict *)NULL; }
 
+  // Clip all other boxes to the MediaBox.
+  void clipBoxes();
+
 private:
 
   GBool readBox(Dict *dict, const char *key, PDFRectangle *box);


More information about the poppler mailing list