[poppler] poppler/OutputDev.h poppler/Page.cc poppler/Page.h poppler/PSOutputDev.h

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Dec 13 10:34:24 PST 2012


 poppler/OutputDev.h   |    5 +++++
 poppler/PSOutputDev.h |    4 +++-
 poppler/Page.cc       |    3 +++
 poppler/Page.h        |    2 ++
 4 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 03045469206adbd797e3a38fee3a16cdd1716812
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Dec 13 19:24:54 2012 +0100

    Fix crop on EPS conversion
    
    Bug #30692
    Patch is half William Bader's and half mine

diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h
index 15af90a..f540d57 100644
--- a/poppler/OutputDev.h
+++ b/poppler/OutputDev.h
@@ -22,6 +22,7 @@
 // Copyright (C) 2009, 2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
+// Copyright (C) 2012 William Bader <williambader at hotmail.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
@@ -111,6 +112,10 @@ public:
   // Does this device require incCharCount to be called for text on
   // non-shown layers?
   virtual GBool needCharCount() { return gFalse; }
+  
+  // Does this device need to clip pages to the crop box even when the
+  // box is the crop box?
+  virtual GBool needClipToCropBox() { return gFalse; }
 
   //----- initialization and control
 
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 809f058..6f29096 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 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2008, 2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2007 Brad Hards <bradh at kde.org>
 // Copyright (C) 2009-2012 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2009 Till Kamppeter <till.kamppeter at gmail.com>
@@ -151,6 +151,8 @@ public:
   // Does this device use beginType3Char/endType3Char?  Otherwise,
   // text in Type 3 fonts will be drawn with drawChar/drawString.
   virtual GBool interpretType3Chars() { return gFalse; }
+  
+  virtual GBool needClipToCropBox() { return mode == psModeEPS; }
 
   //----- header/trailer (used only if manualCtrl is true)
 
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 87bc3a4..8c2065b 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -481,6 +481,9 @@ Gfx *Page::createGfx(OutputDev *out, double hDPI, double vDPI,
     printf("***** Rotate = %d\n", attrs->getRotate());
   }
 
+  if (!crop) {
+    crop = (box == *cropBox) && out->needClipToCropBox();
+  }
   gfx = new Gfx(doc, out, num, attrs->getResourceDict(),
 		hDPI, vDPI, &box, crop ? cropBox : (PDFRectangle *)NULL,
 		rotate, abortCheckCbk, abortCheckCbkData);
diff --git a/poppler/Page.h b/poppler/Page.h
index 78cedc4..a6098ed 100644
--- a/poppler/Page.h
+++ b/poppler/Page.h
@@ -59,6 +59,8 @@ public:
   GBool isValid() { return x1 != 0 || y1 != 0 || x2 != 0 || y2 != 0; }
   GBool contains(double x, double y) { return x1 <= x && x <= x2 && y1 <= y && y <= y2; }
   void clipTo(PDFRectangle *rect);
+  
+  bool operator==(const PDFRectangle &rect) const { return x1 == rect.x1 && y1 == rect.y1 && x2 == rect.x2 && y2 == rect.y2; }
 };
 
 //------------------------------------------------------------------------


More information about the poppler mailing list