mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 03:10:09 +00:00
themingengine: Draw "icon-shadow" on icons
This commit is contained in:
parent
59b6dee480
commit
ce0835e539
@ -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 == >K_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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user