diff options
author | Benjamin Otte <otte@redhat.com> | 2014-05-12 04:14:10 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-05-14 04:28:35 +0200 |
commit | 783e5f7b3ea4b289e89c4a1c51db6e6d70c3304c (patch) | |
tree | b6f358f34e1ed8f4e65ab9d43589ced1a263f853 /gtk/gtkthemingengine.c | |
parent | cb0b4b541086d8b25d2be055cc5174dbb380ce8e (diff) | |
download | gtk+-783e5f7b3ea4b289e89c4a1c51db6e6d70c3304c.tar.gz |
themingengine: Don't transform icon shadows
.. by -gtk-icon-transform. We want a rotating spinner's shadow to still
be directed towards bottom right.
Diffstat (limited to 'gtk/gtkthemingengine.c')
-rw-r--r-- | gtk/gtkthemingengine.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c index 64b9f8ff7c..4cc9832eb6 100644 --- a/gtk/gtkthemingengine.c +++ b/gtk/gtkthemingengine.c @@ -1032,7 +1032,7 @@ render_icon_image (GtkThemingEngine *engine, double height) { const GtkCssValue *shadows; - cairo_matrix_t matrix; + cairo_matrix_t matrix, transform_matrix; GtkCssImage *image; image = _gtk_css_image_value_get_image (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_SOURCE)); @@ -1041,22 +1041,29 @@ render_icon_image (GtkThemingEngine *engine, shadows = _gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_SHADOW); - if (_gtk_css_transform_value_get_matrix (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_TRANSFORM), &matrix)) + cairo_translate (cr, x, y); + + if (_gtk_css_transform_value_get_matrix (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_TRANSFORM), &transform_matrix)) { - cairo_translate (cr, x, y); - cairo_translate (cr, width / 2, height / 2); - cairo_transform (cr, &matrix); - cairo_translate (cr, -width / 2, -height / 2); + /* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */ + cairo_matrix_init_translate (&matrix, width / 2, height / 2); + cairo_matrix_multiply (&matrix, &transform_matrix, &matrix); + cairo_matrix_translate (&matrix, - width / 2, - height / 2); - if (!_gtk_css_shadows_value_is_none (shadows)) + if (_gtk_css_shadows_value_is_none (shadows)) + { + cairo_transform (cr, &matrix); + _gtk_css_image_draw (image, cr, width, height); + } + else { cairo_push_group (cr); + cairo_transform (cr, &matrix); _gtk_css_image_draw (image, cr, width, height); cairo_pop_group_to_source (cr); _gtk_css_shadows_value_paint_icon (shadows, cr); + cairo_paint (cr); } - - _gtk_css_image_draw (image, cr, width, height); } return TRUE; |