[gtk+] themingengine: Render inset box shadow on top of backgrounds



commit b196abe8beac084fe72609e2642f466cc27a35d8
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jun 11 06:19:51 2011 +0200

    themingengine: Render inset box shadow on top of backgrounds

 gtk/gtkshadow.c        |    2 +-
 gtk/gtkthemingengine.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkshadow.c b/gtk/gtkshadow.c
index ebb0df3..33c9d2e 100644
--- a/gtk/gtkshadow.c
+++ b/gtk/gtkshadow.c
@@ -358,7 +358,7 @@ _gtk_box_shadow_render (GtkShadow           *shadow,
                                element->spread, element->spread);
 
       _gtk_rounded_box_path (&box, cr);
-      _gtk_rounded_box_path (padding_box, cr);
+      _gtk_rounded_box_clip_path (padding_box, cr);
 
       gdk_cairo_set_source_rgba (cr, &element->color);
       cairo_fill (cr);
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 67c790a..47f6b9a 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1387,6 +1387,7 @@ render_background_internal (GtkThemingEngine *engine,
   gboolean running;
   gdouble progress;
   GtkRoundedBox border_box;
+  GtkShadow *box_shadow;
 
   flags = gtk_theming_engine_get_state (engine);
 
@@ -1394,6 +1395,7 @@ render_background_internal (GtkThemingEngine *engine,
 
   gtk_theming_engine_get (engine, flags,
                           "background-image", &pattern,
+                          "box-shadow", &box_shadow,
                           NULL);
 
   cairo_save (cr);
@@ -1600,6 +1602,17 @@ render_background_internal (GtkThemingEngine *engine,
   if (pattern)
     cairo_pattern_destroy (pattern);
 
+  if (box_shadow != NULL)
+    {
+      GtkBorder border;
+      gtk_theming_engine_get_border (engine, flags, &border);
+      _gtk_rounded_box_shrink (&border_box,
+                               border.top, border.right,
+                               border.bottom, border.left);
+      _gtk_box_shadow_render (box_shadow, cr, &border_box);
+      _gtk_shadow_unref (box_shadow);
+    }
+
   cairo_restore (cr);
 }
 



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