[poppler] poppler/glib: poppler-document.cc, 1.21, 1.22 poppler-page.cc, 1.20, 1.21 poppler-private.h, 1.7, 1.8

Kristian Hogsberg krh at freedesktop.org
Mon Jun 27 20:44:14 PDT 2005


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

Modified Files:
	poppler-document.cc poppler-page.cc poppler-private.h 
Log Message:
2005-06-27  Kristian Høgsberg  <krh at redhat.com>

        * poppler/CairoOutputDev.cc:
        * poppler/CairoOutputDev.h: Change CairoOutputDev to render to a
        given surface and let the user create that surface.

        * glib/poppler-document.cc:
        * glib/poppler-page.cc:
        * glib/poppler-private.h: Create the cairo image surface here
        instead and pass it to the CairoOutputDev for rendering.

        * poppler/CairoOutputDevImage.cc:
        * poppler/CairoOutputDevImage.h:
        * poppler/CairoOutputDevX.cc:
        * poppler/CairoOutputDevX.h:
        * poppler/Makefile.am: Remove specialized cairo output devices.



Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- poppler-document.cc	20 Jun 2005 18:45:41 -0000	1.21
+++ poppler-document.cc	28 Jun 2005 03:44:12 -0000	1.22
@@ -114,7 +114,7 @@
   document->doc = newDoc;
 
 #if defined (HAVE_CAIRO)
-  document->output_dev = new CairoOutputDevImage ();
+  document->output_dev = new CairoOutputDev ();
 #elif defined (HAVE_SPLASH)
   SplashColor white;
   white.rgb8 = splashMakeRGB8 (0xff, 0xff, 0xff);

Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- poppler-page.cc	20 Jun 2005 21:33:10 -0000	1.20
+++ poppler-page.cc	28 Jun 2005 03:44:12 -0000	1.21
@@ -165,14 +165,26 @@
 			GdkPixbuf *pixbuf,
 			int dest_x, int dest_y)
 {
-  CairoOutputDevImage *output_dev;
+  CairoOutputDev *output_dev;
   int cairo_width, cairo_height, cairo_rowstride;
   int pixbuf_rowstride, pixbuf_n_channels;
   guchar *pixbuf_data, *cairo_data, *dst;
+  cairo_surface_t *surface;
   int x, y;
 
   output_dev = page->document->output_dev;
 
+  cairo_width = MAX ((int)(page->page->getWidth() * scale + 0.5), 1);
+  cairo_height = MAX ((int)(page->page->getHeight() * scale + 0.5), 1);
+  cairo_rowstride = cairo_width * 4;
+  cairo_data = (guchar *) gmalloc (cairo_height * cairo_rowstride);
+  memset (cairo_data, 0xff, cairo_height * cairo_rowstride);
+  surface = cairo_image_surface_create_for_data(cairo_data,
+						CAIRO_FORMAT_ARGB32,
+	  					cairo_width, cairo_height, 
+						cairo_rowstride);
+  output_dev->setSurface (surface);
+
   page->page->displaySlice(output_dev, 72.0 * scale, 72.0 * scale,
 			   poppler_page_get_rotate (page),
 			   gTrue, /* Crop */
@@ -181,9 +193,6 @@
 			   NULL, /* links */
 			   page->document->doc->getCatalog ());
 
-  output_dev->getBitmap (&cairo_data,
-			 &cairo_width, &cairo_height, &cairo_rowstride);
-
   pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
   pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
   pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
@@ -209,6 +218,10 @@
 	  src++;
 	}
     }
+
+  output_dev->setSurface (NULL);
+  cairo_surface_destroy (surface);
+  gfree (cairo_data);
 }
 
 #elif defined (HAVE_SPLASH)

Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-private.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- poppler-private.h	13 Jun 2005 16:09:33 -0000	1.7
+++ poppler-private.h	28 Jun 2005 03:44:12 -0000	1.8
@@ -8,7 +8,7 @@
 #include <FontInfo.h>
 
 #if defined (HAVE_CAIRO)
-#include <CairoOutputDevImage.h>
+#include <CairoOutputDev.h>
 #elif defined (HAVE_SPLASH)
 #include <SplashOutputDev.h>
 #endif
@@ -19,7 +19,7 @@
   PDFDoc *doc;
 
 #if defined (HAVE_CAIRO)
-  CairoOutputDevImage *output_dev;
+  CairoOutputDev *output_dev;
 #elif defined (HAVE_SPLASH)
   SplashOutputDev *output_dev;
 #endif



More information about the poppler mailing list