[gtk+/rendering-cleanup: 29/63] demos: Convert to drawing with Cairo instead of GdkRGB



commit 732a8ad2f96161fa3c43139a956a8108f1d5a3cc
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jul 13 17:17:19 2010 +0200

    demos: Convert to drawing with Cairo instead of GdkRGB

 demos/pixbuf-demo.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/demos/pixbuf-demo.c b/demos/pixbuf-demo.c
index 6c921b5..51977d2 100644
--- a/demos/pixbuf-demo.c
+++ b/demos/pixbuf-demo.c
@@ -89,20 +89,14 @@ load_pixbufs (void)
 static gint
 expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
 {
-	guchar *pixels;
-	int rowstride;
-
-	rowstride = gdk_pixbuf_get_rowstride (frame);
-
-	pixels = gdk_pixbuf_get_pixels (frame) + rowstride * event->area.y + event->area.x * 3;
-		  
-	gdk_draw_rgb_image_dithalign (widget->window,
-				      widget->style->black_gc,
-				      event->area.x, event->area.y,
-				      event->area.width, event->area.height,
-				      GDK_RGB_DITHER_NORMAL,
-				      pixels, rowstride,
-				      event->area.x, event->area.y);
+        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);
 
 	return TRUE;
 }



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