Commit ce0835e5 authored by Benjamin Otte's avatar Benjamin Otte

themingengine: Draw "icon-shadow" on icons

parent 59b6dee4
......@@ -241,6 +241,14 @@ _gtk_css_shadows_value_parse (GtkCssParser *parser)
return result;
}
gboolean
_gtk_css_shadows_value_is_none (const GtkCssValue *shadows)
{
g_return_val_if_fail (shadows->class == &GTK_CSS_VALUE_SHADOWS, TRUE);
return shadows->len == 0;
}
void
_gtk_css_shadows_value_paint_layout (const GtkCssValue *shadows,
cairo_t *cr,
......
......@@ -33,6 +33,8 @@ G_BEGIN_DECLS
GtkCssValue * _gtk_css_shadows_value_new_none (void);
GtkCssValue * _gtk_css_shadows_value_parse (GtkCssParser *parser);
gboolean _gtk_css_shadows_value_is_none (const GtkCssValue *shadows);
void _gtk_css_shadows_value_paint_layout (const GtkCssValue *shadows,
cairo_t *cr,
PangoLayout *layout);
......
......@@ -1031,12 +1031,15 @@ render_icon_image (GtkThemingEngine *engine,
double width,
double height)
{
const GtkCssValue *shadows;
GtkCssImage *image;
image = _gtk_css_image_value_get_image (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_SOURCE));
if (image == NULL)
return FALSE;
shadows = _gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_SHADOW);
cairo_translate (cr, x, y);
cairo_translate (cr, width / 2, height / 2);
......@@ -1044,6 +1047,14 @@ render_icon_image (GtkThemingEngine *engine,
{
cairo_translate (cr, -width / 2, -height / 2);
if (!_gtk_css_shadows_value_is_none (shadows))
{
cairo_push_group (cr);
_gtk_css_image_draw (image, cr, width, height);
cairo_pop_group_to_source (cr);
_gtk_css_shadows_value_paint_icon (shadows, cr);
}
_gtk_css_image_draw (image, cr, width, height);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment