--- 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 #include #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 ("Page rendered in %.4f seconds", @@ -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",