tests: avoid boxed structs copying where possible

Use the GtkStyleContext accessors for boxed properties where possible,
to reduce allocations.
This commit is contained in:
Javier Jardón
2011-05-29 16:45:40 +02:00
parent 20433efbfa
commit e5c7daa828
5 changed files with 41 additions and 59 deletions

View File

@ -20,13 +20,12 @@ draw_callback (GtkWidget *widget,
gpointer data)
{
GtkStyleContext *context;
GdkRGBA *bg;
GdkRGBA rgba;
context = gtk_widget_get_style_context (widget);
gtk_style_context_get (context, 0, "background-color", &bg, NULL);
gdk_cairo_set_source_rgba (cr, bg);
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
gdk_cairo_set_source_rgba (cr, &rgba);
cairo_paint (cr);
gdk_rgba_free (bg);
return TRUE;
}