From f69034a0792d41fc0a34cb48b5b2b0af68576bb0 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 17 Jul 2010 00:18:57 +0200 Subject: [PATCH] gtk-demo: Convert color selection example to Cairo --- demos/gtk-demo/colorsel.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/demos/gtk-demo/colorsel.c b/demos/gtk-demo/colorsel.c index db5d542df3..c671cea51d 100644 --- a/demos/gtk-demo/colorsel.c +++ b/demos/gtk-demo/colorsel.c @@ -22,14 +22,17 @@ expose_event_callback (GtkWidget *widget, if (widget->window) { GtkStyle *style; + cairo_t *cr; style = gtk_widget_get_style (widget); - gdk_draw_rectangle (widget->window, - style->bg_gc[GTK_STATE_NORMAL], - TRUE, - event->area.x, event->area.y, - event->area.width, event->area.height); + cr = gdk_cairo_create (widget->window); + + gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]); + gdk_cairo_rectangle (cr, &event->area); + cairo_fill (cr); + + cairo_destroy (cr); } return TRUE;