[poppler] 2 commits - glib/demo

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Fri Jun 19 05:20:56 PDT 2009


 glib/demo/render.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 2e97524e5d82a4c33a4e6410fead444681db6749
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Jun 19 14:20:16 2009 +0200

    [glib-demo] Use a transparent surface and fill it in white after rendering

diff --git a/glib/demo/render.c b/glib/demo/render.c
index e1973a1..d5bd9d3 100644
--- a/glib/demo/render.c
+++ b/glib/demo/render.c
@@ -165,14 +165,15 @@ pgd_render_start (GtkButton     *button,
 #if defined (HAVE_CAIRO)
 	if (demo->mode == PGD_RENDER_CAIRO) {
 		cairo_t *cr;
-		
+		cairo_pattern_t *pattern;
+
 		timer = g_timer_new ();
-		demo->surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
+		demo->surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
 							    width, height);
 		cr = cairo_create (demo->surface);
 
 		cairo_save (cr);
-		cairo_set_source_rgb (cr, 1, 1, 1);
+		cairo_set_source_rgba (cr, 1., 1., 1., 0);
 		cairo_paint (cr);
 		cairo_restore (cr);
 
@@ -199,6 +200,11 @@ pgd_render_start (GtkButton     *button,
 		
 		poppler_page_render (page, cr);
 		cairo_restore (cr);
+
+		pattern = cairo_pattern_create_rgb (1., 1., 1.);
+		cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER);
+		cairo_set_source (cr, pattern);
+		cairo_paint (cr);
 		g_timer_stop (timer);
 		
 		cairo_destroy (cr);
commit 009937842d5a8bfc12394e9e3ab71b7c33340a85
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Jun 19 14:10:05 2009 +0200

    [glib-demo] Use cairo_paint instead of rectangle + fill

diff --git a/glib/demo/render.c b/glib/demo/render.c
index 1530513..e1973a1 100644
--- a/glib/demo/render.c
+++ b/glib/demo/render.c
@@ -173,8 +173,7 @@ pgd_render_start (GtkButton     *button,
 
 		cairo_save (cr);
 		cairo_set_source_rgb (cr, 1, 1, 1);
-		cairo_rectangle (cr, 0, 0, width, height);
-		cairo_fill (cr);
+		cairo_paint (cr);
 		cairo_restore (cr);
 
 		cairo_save (cr);


More information about the poppler mailing list