1 --- gloobus-preview-build.orig/src/plugin-openoffice/plugin-openoffice.cpp 2011-10-10 14:23:19.205606984 +0200
2 +++ gloobus-preview-build/src/plugin-openoffice/plugin-openoffice.cpp 2011-10-10 14:21:50.870952455 +0200
4 #include "plugin-openoffice.h"
5 +#include "../poppler-gdk.h"
7 #define WIDTH_PERCENT 0.8
8 //======================= CONSTRUCTOR ===================== //
9 --- gloobus-preview-build.orig/src/plugin-pdf/plugin-pdf.cpp 2011-10-10 14:23:19.205606984 +0200
10 +++ gloobus-preview-build/src/plugin-pdf/plugin-pdf.cpp 2011-10-10 14:21:50.870952455 +0200
12 #include "plugin-pdf.h"
13 +#include "../poppler-gdk.h"
15 #define WIDTH_PERCENT 0.8
16 //======================= CONSTRUCTOR ===================== //
17 --- gloobus-preview-build.orig/src/poppler-gdk.h 1970-01-01 01:00:00.000000000 +0100
18 +++ gloobus-preview-build/src/poppler-gdk.h 2011-10-10 14:22:06.077846565 +0200
20 +#include <goo/gtypes.h>
23 +copy_cairo_surface_to_pixbuf (cairo_surface_t *surface,
26 + int cairo_width, cairo_height, cairo_rowstride;
27 + unsigned char *pixbuf_data, *dst, *cairo_data;
28 + int pixbuf_rowstride, pixbuf_n_channels;
32 + cairo_width = cairo_image_surface_get_width (surface);
33 + cairo_height = cairo_image_surface_get_height (surface);
34 + cairo_rowstride = cairo_image_surface_get_stride (surface);
35 + cairo_data = cairo_image_surface_get_data (surface);
37 + pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
38 + pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
39 + pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
41 + if (cairo_width > gdk_pixbuf_get_width (pixbuf))
42 + cairo_width = gdk_pixbuf_get_width (pixbuf);
43 + if (cairo_height > gdk_pixbuf_get_height (pixbuf))
44 + cairo_height = gdk_pixbuf_get_height (pixbuf);
45 + for (y = 0; y < cairo_height; y++)
47 + src = (unsigned int *) (cairo_data + y * cairo_rowstride);
48 + dst = pixbuf_data + y * pixbuf_rowstride;
49 + for (x = 0; x < cairo_width; x++)
51 + dst[0] = (*src >> 16) & 0xff;
52 + dst[1] = (*src >> 8) & 0xff;
53 + dst[2] = (*src >> 0) & 0xff;
54 + if (pixbuf_n_channels == 4)
55 + dst[3] = (*src >> 24) & 0xff;
56 + dst += pixbuf_n_channels;
63 +_poppler_page_render_to_pixbuf (PopplerPage *page,
64 + int src_x, int src_y,
65 + int src_width, int src_height,
72 + cairo_surface_t *surface;
74 + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
75 + src_width, src_height);
76 + cr = cairo_create (surface);
80 + cairo_translate (cr, src_x + src_width, -src_y);
83 + cairo_translate (cr, src_x + src_width, src_y + src_height);
86 + cairo_translate (cr, -src_x, src_y + src_height);
89 + cairo_translate (cr, -src_x, -src_y);
93 + cairo_scale (cr, scale, scale);
96 + cairo_rotate (cr, rotation * G_PI / 180.0);
99 + poppler_page_render_for_printing (page, cr);
101 + poppler_page_render (page, cr);
102 + cairo_restore (cr);
104 + cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER);
105 + cairo_set_source_rgb (cr, 1., 1., 1.);
108 + cairo_destroy (cr);
110 + copy_cairo_surface_to_pixbuf (surface, pixbuf);
111 + cairo_surface_destroy (surface);
115 + * poppler_page_render_to_pixbuf:
116 + * @page: the page to render from
117 + * @src_x: x coordinate of upper left corner
118 + * @src_y: y coordinate of upper left corner
119 + * @src_width: width of rectangle to render
120 + * @src_height: height of rectangle to render
121 + * @scale: scale specified as pixels per point
122 + * @rotation: rotate the document by the specified degree
123 + * @pixbuf: pixbuf to render into
125 + * First scale the document to match the specified pixels per point,
126 + * then render the rectangle given by the upper left corner at
127 + * (src_x, src_y) and src_width and src_height.
128 + * This function is for rendering a page that will be displayed.
129 + * If you want to render a page that will be printed use
130 + * poppler_page_render_to_pixbuf_for_printing() instead
135 +poppler_page_render_to_pixbuf (PopplerPage *page,
136 + int src_x, int src_y,
137 + int src_width, int src_height,
142 + g_return_if_fail (POPPLER_IS_PAGE (page));
143 + g_return_if_fail (scale > 0.0);
144 + g_return_if_fail (pixbuf != NULL);
146 + _poppler_page_render_to_pixbuf (page, src_x, src_y,
147 + src_width, src_height,