[85598] trunk/dports/x11/xournal
ryandesign at macports.org
ryandesign at macports.org
Fri Oct 14 17:59:20 PDT 2011
Revision: 85598
http://trac.macports.org/changeset/85598
Author: ryandesign at macports.org
Date: 2011-10-14 17:59:18 -0700 (Fri, 14 Oct 2011)
Log Message:
-----------
xournal: fix build with and revbump for poppler 0.18; see #31582
Modified Paths:
--------------
trunk/dports/x11/xournal/Portfile
Added Paths:
-----------
trunk/dports/x11/xournal/files/patch-poppler-0.18.diff
Modified: trunk/dports/x11/xournal/Portfile
===================================================================
--- trunk/dports/x11/xournal/Portfile 2011-10-15 00:56:45 UTC (rev 85597)
+++ trunk/dports/x11/xournal/Portfile 2011-10-15 00:59:18 UTC (rev 85598)
@@ -5,7 +5,7 @@
name xournal
version 0.4.5
-revision 7
+revision 8
categories x11
platforms darwin
maintainers ryandesign
@@ -31,7 +31,8 @@
port:zlib
patch.pre_args -p1
-patchfiles xournal-0.4.5-xoprint-len.patch
+patchfiles xournal-0.4.5-xoprint-len.patch \
+ patch-poppler-0.18.diff
configure.ldflags-append -lz
Added: trunk/dports/x11/xournal/files/patch-poppler-0.18.diff
===================================================================
--- trunk/dports/x11/xournal/files/patch-poppler-0.18.diff (rev 0)
+++ trunk/dports/x11/xournal/files/patch-poppler-0.18.diff 2011-10-15 00:59:18 UTC (rev 85598)
@@ -0,0 +1,136 @@
+--- a/src/xo-file.c.orig 2009-09-28 18:36:05.000000000 -0500
++++ b/src/xo-file.c 2011-10-14 19:55:42.000000000 -0500
+@@ -1005,7 +1005,7 @@
+ scaled_height = (int) (req->dpi * height/72);
+ pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
+ FALSE, 8, scaled_width, scaled_height);
+- poppler_page_render_to_pixbuf(
++ wrapper_poppler_page_render_to_pixbuf(
+ pdfpage, 0, 0, scaled_width, scaled_height,
+ req->dpi/72, 0, pixbuf);
+ g_object_unref(pdfpage);
+--- a/src/xo-misc.c.orig 2009-10-02 02:20:30.000000000 -0500
++++ b/src/xo-misc.c 2011-07-21 17:07:33.000000000 -0500
+@@ -2176,3 +2197,93 @@
+ if(GTK_IS_CONTAINER(w))
+ gtk_container_forall(GTK_CONTAINER(w), install_focus_hooks, data);
+ }
++
++// wrapper for missing poppler functions (defunct poppler-gdk api)
++
++static void
++wrapper_copy_cairo_surface_to_pixbuf (cairo_surface_t *surface,
++ GdkPixbuf *pixbuf)
++{
++ int cairo_width, cairo_height, cairo_rowstride;
++ unsigned char *pixbuf_data, *dst, *cairo_data;
++ int pixbuf_rowstride, pixbuf_n_channels;
++ unsigned int *src;
++ int x, y;
++
++ cairo_width = cairo_image_surface_get_width (surface);
++ cairo_height = cairo_image_surface_get_height (surface);
++ cairo_rowstride = cairo_image_surface_get_stride (surface);
++ cairo_data = cairo_image_surface_get_data (surface);
++
++ pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
++ pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
++ pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
++
++ if (cairo_width > gdk_pixbuf_get_width (pixbuf))
++ cairo_width = gdk_pixbuf_get_width (pixbuf);
++ if (cairo_height > gdk_pixbuf_get_height (pixbuf))
++ cairo_height = gdk_pixbuf_get_height (pixbuf);
++ for (y = 0; y < cairo_height; y++)
++ {
++ src = (unsigned int *) (cairo_data + y * cairo_rowstride);
++ dst = pixbuf_data + y * pixbuf_rowstride;
++ for (x = 0; x < cairo_width; x++)
++ {
++ dst[0] = (*src >> 16) & 0xff;
++ dst[1] = (*src >> 8) & 0xff;
++ dst[2] = (*src >> 0) & 0xff;
++ if (pixbuf_n_channels == 4)
++ dst[3] = (*src >> 24) & 0xff;
++ dst += pixbuf_n_channels;
++ src++;
++ }
++ }
++}
++
++void
++wrapper_poppler_page_render_to_pixbuf (PopplerPage *page,
++ int src_x, int src_y,
++ int src_width, int src_height,
++ double scale,
++ int rotation,
++ GdkPixbuf *pixbuf)
++{
++ cairo_t *cr;
++ cairo_surface_t *surface;
++
++ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
++ src_width, src_height);
++ cr = cairo_create (surface);
++ cairo_save (cr);
++ switch (rotation) {
++ case 90:
++ cairo_translate (cr, src_x + src_width, -src_y);
++ break;
++ case 180:
++ cairo_translate (cr, src_x + src_width, src_y + src_height);
++ break;
++ case 270:
++ cairo_translate (cr, -src_x, src_y + src_height);
++ break;
++ default:
++ cairo_translate (cr, -src_x, -src_y);
++ }
++
++ if (scale != 1.0)
++ cairo_scale (cr, scale, scale);
++
++ if (rotation != 0)
++ cairo_rotate (cr, rotation * G_PI / 180.0);
++
++ poppler_page_render (page, cr);
++ cairo_restore (cr);
++
++ cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER);
++ cairo_set_source_rgb (cr, 1., 1., 1.);
++ cairo_paint (cr);
++
++ cairo_destroy (cr);
++
++ wrapper_copy_cairo_surface_to_pixbuf (surface, pixbuf);
++ cairo_surface_destroy (surface);
++}
+--- a/src/xo-misc.h.orig 2009-09-27 22:45:56.000000000 -0500
++++ b/src/xo-misc.h 2011-07-21 17:07:33.000000000 -0500
+@@ -107,6 +107,15 @@
+ gboolean intercept_activate_events(GtkWidget *w, GdkEvent *ev, gpointer data);
+ void install_focus_hooks(GtkWidget *w, gpointer data);
+
++// wrapper for a function no longer provided by poppler 0.17+
++void
++wrapper_poppler_page_render_to_pixbuf (PopplerPage *page,
++ int src_x, int src_y,
++ int src_width, int src_height,
++ double scale,
++ int rotation,
++ GdkPixbuf *pixbuf);
++
+ // defines for paper rulings
+
+ #define RULING_MARGIN_COLOR 0xff0080ff
+--- a/src/xo-print.c.orig 2009-09-28 16:36:54.000000000 -0500
++++ b/src/xo-print.c 2011-07-21 17:07:33.000000000 -0500
+@@ -728,7 +728,7 @@
+ width = (int) (PDFTOPPM_PRINTING_DPI * pgwidth/72.0);
+ height = (int) (PDFTOPPM_PRINTING_DPI * pgheight/72.0);
+ pix = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, height);
+- poppler_page_render_to_pixbuf(
++ wrapper_poppler_page_render_to_pixbuf(
+ pdfpage, 0, 0, width, height, PDFTOPPM_PRINTING_DPI/72.0, 0, pix);
+ g_object_unref(pdfpage);
+ }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20111014/f75305a3/attachment-0001.html>
More information about the macports-changes
mailing list