[gtk+/rendering-cleanup-next: 124/155] pixbuf-demo: Use draw signal



commit 1f7f3cc9b631c0cb6998feb64085ce40dcfef5ea
Author: Benjamin Otte <otte redhat com>
Date:   Thu Sep 9 00:58:30 2010 +0200

    pixbuf-demo: Use draw signal

 demos/pixbuf-demo.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/demos/pixbuf-demo.c b/demos/pixbuf-demo.c
index 51977d2..3c3b261 100644
--- a/demos/pixbuf-demo.c
+++ b/demos/pixbuf-demo.c
@@ -86,17 +86,11 @@ load_pixbufs (void)
 }
 
 /* Expose callback for the drawing area */
-static gint
-expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
+static gboolean
+draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
 {
-        cairo_t *cr;
-         
-        cr = gdk_cairo_create (event->window);
         gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
-        gdk_cairo_rectangle (cr, &event->area);
-        cairo_fill (cr);
-
-        cairo_destroy (cr);
+        cairo_paint (cr);
 
 	return TRUE;
 }
@@ -214,8 +208,8 @@ main (int argc, char **argv)
 
 	da = gtk_drawing_area_new ();
 
-	g_signal_connect (da, "expose_event",
-			  G_CALLBACK (expose_cb), NULL);
+	g_signal_connect (da, "draw",
+			  G_CALLBACK (draw_cb), NULL);
 
 	gtk_container_add (GTK_CONTAINER (window), da);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]