[gtk+/wip/blur: 6/7] shadow: add blur to icon-shadow (icon)



commit f2056e6bf34efe1ac09cca3338cb88407e277bde
Author: Andrea Cimitan <andrea cimitan canonical com>
Date:   Mon Apr 16 13:02:59 2012 +0100

    shadow: add blur to icon-shadow (icon)

 gtk/gtkcssshadowvalue.c |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index dc8578d..e6ff1dd 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -386,12 +386,37 @@ _gtk_css_shadow_value_paint_icon (const GtkCssValue *shadow,
 
   cairo_save (cr);
   pattern = cairo_pattern_reference (cairo_get_source (cr));
-  gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
 
-  cairo_translate (cr,
-                   _gtk_css_number_value_get (shadow->hoffset, 0),
-                   _gtk_css_number_value_get (shadow->voffset, 0));
-  cairo_mask (cr, pattern);
+  if (_gtk_css_number_value_get (shadow->radius, 0) > 0)
+    {
+      cairo_t *blur_cr;
+      cairo_surface_t *surface;
+
+      _gtk_css_shadow_value_blur_surface_create (shadow, cr,
+                                                 &blur_cr, &surface);
+
+      /* Create the path on the surface to blur. */
+      gdk_cairo_set_source_rgba (blur_cr, _gtk_css_rgba_value_get_rgba (shadow->color));
+          
+      cairo_translate (blur_cr,                        
+                       _gtk_css_number_value_get (shadow->hoffset, 0),
+                       _gtk_css_number_value_get (shadow->voffset, 0));
+      cairo_mask (blur_cr, pattern);
+
+      _gtk_css_shadow_value_blur_surface_paint (shadow, cr, surface);
+
+      cairo_destroy (blur_cr);
+      cairo_surface_destroy (surface); 
+    }
+  else
+    {
+      gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
+
+      cairo_translate (cr,
+                       _gtk_css_number_value_get (shadow->hoffset, 0),
+                       _gtk_css_number_value_get (shadow->voffset, 0));
+      cairo_mask (cr, pattern);
+    }
 
   cairo_restore (cr);
   cairo_pattern_destroy (pattern);



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