[gtk+/wip/css-icons] themingengine: Don't transform icon shadows



commit 2a54fb0a75d69d361d4165a3fd809f4192fd8810
Author: Benjamin Otte <otte redhat com>
Date:   Mon May 12 04:14:10 2014 +0200

    themingengine: Don't transform icon shadows
    
    .. by -gtk-icon-transform. We want a rotating spinner's shadow to still
    be directed towards bottom right.

 gtk/gtkthemingengine.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 64b9f8f..4cc9832 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]