theming: Use peek_property() calls to query shadows

This commit is contained in:
Benjamin Otte
2012-03-28 01:03:39 +02:00
parent a33df2d1d6
commit 281d094b42
2 changed files with 4 additions and 19 deletions

View File

@ -303,14 +303,11 @@ _gtk_theming_background_apply_shadow (GtkThemingBackground *bg,
{ {
GtkShadow *box_shadow; GtkShadow *box_shadow;
gtk_style_context_get (bg->context, bg->flags, box_shadow = _gtk_css_value_get_shadow (_gtk_style_context_peek_property (bg->context, "box-shadow"));
"box-shadow", &box_shadow,
NULL);
if (box_shadow != NULL) if (box_shadow != NULL)
{ {
_gtk_box_shadow_render (box_shadow, cr, &bg->padding_box); _gtk_box_shadow_render (box_shadow, cr, &bg->padding_box);
_gtk_shadow_unref (box_shadow);
} }
} }

View File

@ -2132,16 +2132,13 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
fg_color.alpha = CLAMP (fg_color.alpha + ((other_fg.alpha - fg_color.alpha) * progress), 0, 1); fg_color.alpha = CLAMP (fg_color.alpha + ((other_fg.alpha - fg_color.alpha) * progress), 0, 1);
} }
gtk_theming_engine_get (engine, flags, text_shadow = _gtk_css_value_get_shadow (_gtk_theming_engine_peek_property (engine, "text-shadow"));
"text-shadow", &text_shadow,
NULL);
prepare_context_for_layout (cr, x, y, layout); prepare_context_for_layout (cr, x, y, layout);
if (text_shadow != NULL) if (text_shadow != NULL)
{ {
_gtk_text_shadow_paint_layout (text_shadow, cr, layout); _gtk_text_shadow_paint_layout (text_shadow, cr, layout);
_gtk_shadow_unref (text_shadow);
} }
gdk_cairo_set_source_rgba (cr, &fg_color); gdk_cairo_set_source_rgba (cr, &fg_color);
@ -2769,9 +2766,7 @@ render_spinner (GtkThemingEngine *engine,
radius = MIN (width / 2, height / 2); radius = MIN (width / 2, height / 2);
gtk_theming_engine_get_color (engine, state, &color); gtk_theming_engine_get_color (engine, state, &color);
gtk_theming_engine_get (engine, state, shadow = _gtk_css_value_get_shadow (_gtk_theming_engine_peek_property (engine, "icon-shadow"));
"icon-shadow", &shadow,
NULL);
cairo_save (cr); cairo_save (cr);
cairo_translate (cr, x + width / 2, y + height / 2); cairo_translate (cr, x + width / 2, y + height / 2);
@ -2781,7 +2776,6 @@ render_spinner (GtkThemingEngine *engine,
_gtk_icon_shadow_paint_spinner (shadow, cr, _gtk_icon_shadow_paint_spinner (shadow, cr,
radius, radius,
progress); progress);
_gtk_shadow_unref (shadow);
} }
_gtk_theming_engine_paint_spinner (cr, _gtk_theming_engine_paint_spinner (cr,
@ -2949,23 +2943,17 @@ gtk_theming_engine_render_icon (GtkThemingEngine *engine,
gdouble x, gdouble x,
gdouble y) gdouble y)
{ {
GtkStateFlags state;
GtkShadow *icon_shadow; GtkShadow *icon_shadow;
state = gtk_theming_engine_get_state (engine);
cairo_save (cr); cairo_save (cr);
gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y); gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
gtk_theming_engine_get (engine, state, icon_shadow = _gtk_css_value_get_shadow (_gtk_theming_engine_peek_property (engine, "icon-shadow"));
"icon-shadow", &icon_shadow,
NULL);
if (icon_shadow != NULL) if (icon_shadow != NULL)
{ {
_gtk_icon_shadow_paint (icon_shadow, cr); _gtk_icon_shadow_paint (icon_shadow, cr);
_gtk_shadow_unref (icon_shadow);
} }
cairo_paint (cr); cairo_paint (cr);