[gtk+/gtk-style-context: 336/490] GtkThemingEngine: ensure that background isn't rendered past the frame boundaries.



commit 83fe0a692177e85d1328f1498c4de96b98e21f6b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Nov 8 20:12:15 2010 +0100

    GtkThemingEngine: ensure that background isn't rendered past the frame boundaries.

 gtk/gtkthemingengine.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 3ed2903..34d8acf 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1358,7 +1358,7 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
   gboolean running;
   gdouble progress, alpha = 1;
   GtkJunctionSides junction;
-  gint radius;
+  gint radius, border_width;
 
   flags = gtk_theming_engine_get_state (engine);
   junction = gtk_theming_engine_get_junction_sides (engine);
@@ -1376,11 +1376,24 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
   gtk_theming_engine_get (engine, flags,
                           "background-image", &pattern,
                           "background-color", &bg_color,
+                          "border-width", &border_width,
                           "border-radius", &radius,
                           NULL);
 
   running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
 
+  if (border_width > 0)
+    {
+      x += border_width;
+      y += border_width;
+      width -= 2 * border_width;
+      height -= 2 * border_width;
+      radius -= 2 * border_width;
+
+      if (radius < 0)
+        radius = 0;
+    }
+
   _cairo_round_rectangle_sides (cr, (gdouble) radius,
                                 x, y, width, height,
                                 SIDE_ALL, junction);



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