[poppler] poppler/glib: poppler-document.cc, 1.10, 1.11 poppler-page.cc, 1.15, 1.16 poppler-private.h, 1.5, 1.6

Kristian Hogsberg krh at freedesktop.org
Wed Apr 20 22:20:27 PDT 2005


Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv20055/glib

Modified Files:
	poppler-document.cc poppler-page.cc poppler-private.h 
Log Message:
Thu Apr 21 00:15:30 2005  Kristian Høgsberg  <krh at redhat.com>

        * glib/poppler-document.cc (poppler_document_new_from_file): Add
        output device (cairo or splash) to PopplerDocument and initialize
        it in the constructor.

        * glib/poppler-page.cc (splash_render_to_pixbuf,
        cairo_render_to_pixbuf): Use output device from associated poppler
        document instead of creating a new one.

        * poppler-glib.pc.in (Requires): Add Requires: field.

        * poppler/Page.cc (loadThumb): Remove unecessary and buggy call to
        Stream::addFilters(), reported by Ryan Lortie (#3046).



Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- poppler-document.cc	19 Apr 2005 21:22:26 -0000	1.10
+++ poppler-document.cc	21 Apr 2005 05:20:25 -0000	1.11
@@ -105,6 +105,15 @@
 
   document->doc = newDoc;
 
+#if defined (HAVE_CAIRO)
+  document->output_dev = new CairoOutputDevImage ();
+#elif defined (HAVE_SPLASH)
+  SplashColor white;
+  white.rgb8 = splashMakeRGB8 (0xff, 0xff, 0xff);
+  document->output_dev = new SplashOutputDev(splashModeRGB8, gFalse, white);
+#endif
+  document->output_dev->startDoc(document->doc->getXRef ());
+
   return document;
 }
 
@@ -133,6 +142,7 @@
 {
   PopplerDocument *document = POPPLER_DOCUMENT (object);
 
+  delete document->output_dev;
   delete document->doc;
 }
 

Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- poppler-page.cc	16 Apr 2005 18:57:44 -0000	1.15
+++ poppler-page.cc	21 Apr 2005 05:20:25 -0000	1.16
@@ -29,14 +29,6 @@
 #include <GfxState.h>
 #include <TextOutputDev.h>
 
-#if defined (HAVE_CAIRO)
-#include <CairoOutputDevImage.h>
-#endif
-
-#if defined (HAVE_SPLASH)
-#include <SplashOutputDev.h>
-#endif
-
 #include "poppler.h"
 #include "poppler-private.h"
 
@@ -185,9 +177,7 @@
   guchar *pixbuf_data, *cairo_data, *dst;
   int x, y;
 
-  output_dev = new CairoOutputDevImage ();
-
-  output_dev->startDoc(page->document->doc->getXRef ());
+  output_dev = page->document->output_dev;
 
   page->page->displaySlice(output_dev, 72.0 * scale, 72.0 * scale,
 			   poppler_page_get_rotate (page),
@@ -225,8 +215,6 @@
 	  src++;
 	}
     }
-
-  delete output_dev;
 }
 
 #elif defined (HAVE_SPLASH)
@@ -240,7 +228,6 @@
 			 int dest_x, int dest_y)
 {
   SplashOutputDev *output_dev;
-  SplashColor white;
   SplashBitmap *bitmap;
   SplashColorPtr color_ptr;
   int splash_width, splash_height, splash_rowstride;
@@ -248,10 +235,7 @@
   guchar *pixbuf_data, *dst;
   int x, y;
 
-  white.rgb8 = splashMakeRGB8 (0xff, 0xff, 0xff);
-  output_dev = new SplashOutputDev(splashModeRGB8, gFalse, white);
-
-  output_dev->startDoc(page->document->doc->getXRef ());
+  output_dev = page->document->output_dev;
 
   page->page->displaySlice(output_dev, 72.0 * scale, 72.0 * scale,
 			   poppler_page_get_rotate (page),
@@ -293,8 +277,6 @@
 	  src++;
 	}
     }
-
-  delete output_dev;
 }
 
 #endif

Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-private.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- poppler-private.h	15 Apr 2005 02:25:11 -0000	1.5
+++ poppler-private.h	21 Apr 2005 05:20:25 -0000	1.6
@@ -1,14 +1,27 @@
 #ifndef __POPPLER_PRIVATE_H__
 #define __POPPLER_PRIVATE_H__
 
+#include <config.h>
 #include <PDFDoc.h>
 #include <PSOutputDev.h>
 #include <Link.h>
 
+#if defined (HAVE_CAIRO)
+#include <CairoOutputDevImage.h>
+#elif defined (HAVE_SPLASH)
+#include <SplashOutputDev.h>
+#endif
+
 struct _PopplerDocument
 {
   GObject parent_instance;
   PDFDoc *doc;
+
+#if defined (HAVE_CAIRO)
+  CairoOutputDevImage *output_dev;
+#elif defined (HAVE_SPLASH)
+  SplashOutputDev *output_dev;
+#endif
 };
 
 struct _PopplerPSFile



More information about the poppler mailing list