[poppler] glib/poppler-page.cc poppler/CairoOutputDev.cc poppler/CairoOutputDev.h

Jeff Muizelaar jrmuizel at kemper.freedesktop.org
Sun Feb 10 15:48:22 PST 2008


 glib/poppler-page.cc      |    1 +
 poppler/CairoOutputDev.cc |    3 ++-
 poppler/CairoOutputDev.h  |    2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit fdb0a4a2f1d86aec7a3b0fcd4b4d48455791ecad
Author: Jeff Muizelaar <jeff at infidigm.net>
Date:   Sun Feb 10 18:47:40 2008 -0500

    Avoid prescaling images when printing.
    
    Adds a function for letting the CairoOutputDev know whether it is targetting a
    screen or not. It then uses this knowledge to avoid prescaling images. This way
    cairo gets the full resolution image for use in the printed output.

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 803effe..001bb25 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -425,6 +425,7 @@ _poppler_page_render (PopplerPage *page,
 
   output_dev = page->document->output_dev;
   output_dev->setCairo (cairo);
+  output_dev->setPrinting (printing);
 
   /* NOTE: instead of passing -1 we should/could use cairo_clip_extents()
    * to get a bounding box */
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 99f5c2b..0bc0ab4 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -88,6 +88,7 @@ CairoOutputDev::CairoOutputDev() {
   cairo = NULL;
   currentFont = NULL;
   prescaleImages = gTrue;
+  printing = gTrue;
 
   groupColorSpaceStack = NULL;
   group = NULL;
@@ -908,7 +909,7 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
   cairo_get_matrix (cairo, &matrix);
   //XXX: it is possible that we should only do sub pixel positioning if 
   // we are rendering fonts */
-  if (prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) {
+  if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) {
     drawImageMaskPrescaled(state, ref, str, width, height, invert, inlineImg);
   } else {
     drawImageMaskRegular(state, ref, str, width, height, invert, inlineImg);
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index ae44532..5d2b658 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -193,6 +193,7 @@ public:
   GBool isReverseVideo() { return gFalse; }
   
   void setCairo (cairo_t *cr);
+  void setPrinting (GBool printing) { this->printing = printing; }
 
 protected:
   void doPath(cairo_t *cairo, GfxState *state, GfxPath *path);
@@ -210,6 +211,7 @@ protected:
   cairo_t *cairo;
   cairo_matrix_t orig_matrix;
   GBool needFontUpdate;                // set when the font needs to be updated
+  GBool printing;
   cairo_surface_t *surface;
   cairo_glyph_t *glyphs;
   int glyphCount;


More information about the poppler mailing list