diff options
author | Benjamin Otte <otte@redhat.com> | 2010-07-13 15:57:18 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-07-26 16:42:48 +0200 |
commit | 4d07fa577292723b2436070bc97a6d3cf7e3e322 (patch) | |
tree | 635716a87239641e92d99dc4996c23e5a8b2c487 /demos | |
parent | 1e64e36b5828c55138d1a11ac2b5814f8121a9e2 (diff) | |
download | gtk+-4d07fa577292723b2436070bc97a6d3cf7e3e322.tar.gz |
gtk-demo: Make pixbufs demo use Cairo
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/pixbufs.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/demos/gtk-demo/pixbufs.c b/demos/gtk-demo/pixbufs.c index d7b7eef3e9..e2fbcb06a5 100644 --- a/demos/gtk-demo/pixbufs.c +++ b/demos/gtk-demo/pixbufs.c @@ -100,20 +100,15 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) { - guchar *pixels; - int rowstride; + cairo_t *cr; - rowstride = gdk_pixbuf_get_rowstride (frame); + cr = gdk_cairo_create (event->window); - pixels = gdk_pixbuf_get_pixels (frame) + rowstride * event->area.y + event->area.x * 3; + gdk_cairo_set_source_pixbuf (cr, frame, 0, 0); + gdk_cairo_rectangle (cr, &event->area); + cairo_fill (cr); - 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_destroy (cr); return TRUE; } |