[poppler] [Patch] Fix glib + splash compilation

Marco Pesenti Gritti mpgritti at gmail.com
Thu Jun 30 02:05:26 PDT 2005


Patch attached (if I remember this time :P).
I have two doubts:

- What's the deal with dest_x / dest_y, they seem to be ignored now.
Do we want to remove them from the API? My patch does that...

- In poppler_page_render_selection can we use OutputDev or we need to
use defines and Splash/CairoOutputDev ?

Marco
-------------- next part --------------
? a
? poppler/.Makefile.swp
Index: glib/poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.23
diff -u -r1.23 poppler-page.cc
--- glib/poppler-page.cc	30 Jun 2005 00:36:01 -0000	1.23
+++ glib/poppler-page.cc	30 Jun 2005 08:59:20 -0000
@@ -254,6 +254,7 @@
   /* pft */
 }
 
+static void
 poppler_page_copy_to_pixbuf(PopplerPage *page,
 			    GdkPixbuf *pixbuf,
 			    OutputDevData *data)
@@ -279,18 +280,17 @@
   pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
   pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
 
-  if (dest_x + splash_width > gdk_pixbuf_get_width (pixbuf))
-    splash_width = gdk_pixbuf_get_width (pixbuf) - dest_x;
-  if (dest_y + splash_height > gdk_pixbuf_get_height (pixbuf))
-    splash_height = gdk_pixbuf_get_height (pixbuf) - dest_y;
+  if (splash_width > gdk_pixbuf_get_width (pixbuf))
+    splash_width = gdk_pixbuf_get_width (pixbuf);
+  if (splash_height > gdk_pixbuf_get_height (pixbuf))
+    splash_height = gdk_pixbuf_get_height (pixbuf);
 
   for (y = 0; y < splash_height; y++)
     {
       SplashRGB8 *src;
 
       src = (SplashRGB8 *) (color_ptr.rgb8p + y * splash_rowstride);
-      dst = pixbuf_data + (dest_y + y) * pixbuf_rowstride +
-	dest_x * pixbuf_n_channels;
+      dst = pixbuf_data + y * pixbuf_rowstride;
       for (x = 0; x < splash_width; x++) 
 	{
 	  dst[0] = splashRGB8R(*src);
@@ -313,22 +313,18 @@
  * @src_height: height of rectangle to render
  * @ppp: pixels per point
  * @pixbuf: pixbuf to render into
- * @dest_x: x coordinate of offset into destination
- * @dest_y: y cooridnate of offset into destination
  *
  * First scale the document to match the specified pixels per point,
  * then render the rectangle given by the upper left corner at
- * (src_x, src_y) and src_width and src_height.  The rectangle is
- * rendered into the specified pixmap with the upper left corner
- * placed at (dest_x, dest_y).
+ * (src_x, src_y) and src_width and src_height.
+ *
  **/
 void
 poppler_page_render_to_pixbuf (PopplerPage *page,
 			       int src_x, int src_y,
 			       int src_width, int src_height,
 			       double scale,
-			       GdkPixbuf *pixbuf,
-			       int dest_x, int dest_y)
+			       GdkPixbuf *pixbuf)
 {
   OutputDevData data;
 
@@ -418,9 +414,7 @@
 			       PopplerRectangle *old_selection)
 {
   TextOutputDev *text_dev;
-  CairoOutputDev *output_dev;
-  cairo_surface_t *surface;
-  unsigned char *cairo_data;
+  OutputDev *output_dev;
   OutputDevData data;
   PDFRectangle pdf_selection(selection->x1, selection->y1,
 			     selection->x2, selection->y2);
Index: glib/poppler-page.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.h,v
retrieving revision 1.15
diff -u -r1.15 poppler-page.h
--- glib/poppler-page.h	29 Jun 2005 21:24:56 -0000	1.15
+++ glib/poppler-page.h	30 Jun 2005 08:59:21 -0000
@@ -40,9 +40,7 @@
 						       int                 src_width,
 						       int                 src_height,
 						       double              scale,
-						       GdkPixbuf          *pixbuf,
-						       int                 dest_x,
-						       int                 dest_y);
+						       GdkPixbuf          *pixbuf);
 void                poppler_page_get_size             (PopplerPage        *page,
 						       double             *width,
 						       double             *height);
Index: glib/test-poppler-glib.c
===================================================================
RCS file: /cvs/poppler/poppler/glib/test-poppler-glib.c,v
retrieving revision 1.12
diff -u -r1.12 test-poppler-glib.c
--- glib/test-poppler-glib.c	13 Jun 2005 16:09:33 -0000	1.12
+++ glib/test-poppler-glib.c	30 Jun 2005 08:59:21 -0000
@@ -135,7 +135,7 @@
 
   pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 220, 220);
   gdk_pixbuf_fill (pixbuf, 0x00106000);
-  poppler_page_render_to_pixbuf (page, 100, 100, 200, 200, 1, pixbuf, 10, 10);
+  poppler_page_render_to_pixbuf (page, 100, 100, 200, 200, 1, pixbuf);
 
   gdk_pixbuf_save (pixbuf, "slice.png", "png", &error, NULL);
   printf ("\tslice:\t\tsaved 200x200 slice at (100, 100) as slice.png\n");


More information about the poppler mailing list