1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
--- glib/poppler-page.cc 2007/09/03 08:54:03 1.69
+++ glib/poppler-page.cc 2007/09/05 10:57:30 1.69.2.1
@@ -581,10 +581,11 @@
#if defined (HAVE_CAIRO)
static void
-poppler_page_set_selection_alpha (PopplerPage *page,
- double scale,
- GdkPixbuf *pixbuf,
- PopplerRectangle *selection)
+poppler_page_set_selection_alpha (PopplerPage *page,
+ double scale,
+ GdkPixbuf *pixbuf,
+ PopplerSelectionStyle style,
+ PopplerRectangle *selection)
{
/* Cairo doesn't need this, since cairo generates an alpha channel. */
}
@@ -592,10 +593,11 @@
#elif defined (HAVE_SPLASH)
static void
-poppler_page_set_selection_alpha (PopplerPage *page,
- double scale,
- GdkPixbuf *pixbuf,
- PopplerRectangle *selection)
+poppler_page_set_selection_alpha (PopplerPage *page,
+ double scale,
+ GdkPixbuf *pixbuf,
+ PopplerSelectionStyle style,
+ PopplerRectangle *selection)
{
GdkRegion *region;
gint n_rectangles, i, x, y, width, height;
@@ -620,7 +622,7 @@
}
}
- region = poppler_page_get_selection_region (page, scale, selection);
+ region = poppler_page_get_selection_region (page, scale, style, selection);
gdk_region_get_rectangles (region, &rectangles, &n_rectangles);
for (i = 0; i < n_rectangles; i++) {
@@ -803,7 +805,7 @@
poppler_page_copy_to_pixbuf (page, pixbuf, &data);
- poppler_page_set_selection_alpha (page, scale, pixbuf, selection);
+ poppler_page_set_selection_alpha (page, scale, pixbuf, style, selection);
/* We'll need a function to destroy page->text_dev and page->gfx
* when the application wants to get rid of them.
--- glib/demo/render.c 2007/08/26 10:52:19 1.1
+++ glib/demo/render.c 2007/09/05 10:57:30 1.1.2.1
@@ -16,13 +16,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "config.h"
+
#include <gtk/gtk.h>
#include <cairo.h>
#include "render.h"
typedef enum {
+#if defined (HAVE_CAIRO)
PGD_RENDER_CAIRO,
+#endif
PGD_RENDER_PIXBUF
} PgdRenderMode;
@@ -43,8 +47,10 @@
GtkWidget *slice_w;
GtkWidget *slice_h;
GtkWidget *timer_label;
-
+
+#if defined (HAVE_CAIRO)
cairo_surface_t *surface;
+#endif
GdkPixbuf *pixbuf;
} PgdRenderDemo;
@@ -58,11 +64,13 @@
g_object_unref (demo->doc);
demo->doc = NULL;
}
-
+
+#if defined (HAVE_CAIRO)
if (demo->surface) {
cairo_surface_destroy (demo->surface);
demo->surface = NULL;
}
+#endif
if (demo->pixbuf) {
g_object_unref (demo->pixbuf);
@@ -77,13 +85,17 @@
GdkEventExpose *event,
PgdRenderDemo *demo)
{
+#if defined (HAVE_CAIRO)
if (demo->mode == PGD_RENDER_CAIRO && !demo->surface)
return FALSE;
+#endif
+
if (demo->mode == PGD_RENDER_PIXBUF && !demo->pixbuf)
return FALSE;
gdk_window_clear (area->window);
+#if defined (HAVE_CAIRO)
if (demo->mode == PGD_RENDER_CAIRO) {
cairo_t *cr;
@@ -92,6 +104,7 @@
cairo_paint (cr);
cairo_destroy (cr);
} else if (demo->mode == PGD_RENDER_PIXBUF) {
+#endif
gdk_draw_pixbuf (area->window,
area->style->fg_gc[GTK_STATE_NORMAL],
demo->pixbuf,
@@ -101,10 +114,12 @@
gdk_pixbuf_get_height (demo->pixbuf),
GDK_RGB_DITHER_NORMAL,
0, 0);
+#if defined (HAVE_CAIRO)
} else {
g_assert_not_reached ();
}
-
+#endif
+
return TRUE;
}
@@ -122,9 +137,12 @@
if (!page)
return;
+#if defined (HAVE_CAIRO)
if (demo->surface)
cairo_surface_destroy (demo->surface);
demo->surface = NULL;
+#endif
+
if (demo->pixbuf)
g_object_unref (demo->pixbuf);
demo->pixbuf = NULL;
@@ -139,6 +157,7 @@
height = page_width * demo->scale;
}
+#if defined (HAVE_CAIRO)
if (demo->mode == PGD_RENDER_CAIRO) {
cairo_t *cr;
@@ -179,6 +198,7 @@
cairo_destroy (cr);
} else if (demo->mode == PGD_RENDER_PIXBUF) {
+#endif
timer = g_timer_new ();
demo->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
FALSE, 8, width, height);
@@ -190,10 +210,11 @@
demo->rotate,
demo->pixbuf);
g_timer_stop (timer);
+#if defined (HAVE_CAIRO)
} else {
g_assert_not_reached ();
}
-
+#endif
g_object_unref (page);
str = g_strdup_printf ("<i>Page rendered in %.4f seconds</i>",
@@ -360,7 +381,9 @@
gtk_widget_show (label);
mode_selector = gtk_combo_box_new_text ();
+#if defined (HAVE_CAIRO)
gtk_combo_box_append_text (GTK_COMBO_BOX (mode_selector), "cairo");
+#endif
gtk_combo_box_append_text (GTK_COMBO_BOX (mode_selector), "pixbuf");
gtk_combo_box_set_active (GTK_COMBO_BOX (mode_selector), 0);
g_signal_connect (G_OBJECT (mode_selector), "changed",
|