[gtk+/rendering-cleanup: 82/124] gtk-demo: Convert color selection example to Cairo



commit 0ea7563a6dff8438fe88589d6dc937293ab0c26a
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jul 17 00:18:57 2010 +0200

    gtk-demo: Convert color selection example to Cairo

 demos/gtk-demo/colorsel.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/demos/gtk-demo/colorsel.c b/demos/gtk-demo/colorsel.c
index db5d542..c671cea 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;



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