[gtk+] Avoid rendering frames when shadow type argument is GTK_SHADOW_NONE in gtk_paint_* functions.



commit 05254766c7c174cbc4951ec6df1ad64826f6c9f5
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Tue Dec 28 23:15:39 2010 +0900

    Avoid rendering frames when shadow type argument is GTK_SHADOW_NONE in
    gtk_paint_* functions.

 gtk/gtkstyle.c |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 635bacf..40c3928 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -1639,6 +1639,9 @@ gtk_default_draw_shadow (GtkStyle      *style,
   GtkStyleContext *context;
   GtkStylePrivate *priv;
 
+  if (shadow_type == GTK_SHADOW_NONE)
+    return;
+
   if (widget)
     context = gtk_widget_get_style_context (widget);
   else
@@ -1995,7 +1998,9 @@ gtk_default_draw_box (GtkStyle      *style,
   else
     {
       gtk_render_background (context, cr, x, y, width, height);
-      gtk_render_frame (context, cr, x, y, width, height);
+
+      if (shadow_type != GTK_SHADOW_NONE)
+	gtk_render_frame (context, cr, x, y, width, height);
     }
 
   cairo_restore (cr);
@@ -2255,6 +2260,9 @@ gtk_default_draw_shadow_gap (GtkStyle       *style,
   GtkStylePrivate *priv;
   GtkStateFlags flags = 0;
 
+  if (shadow_type == GTK_SHADOW_NONE)
+    return;
+
   if (widget)
     context = gtk_widget_get_style_context (widget);
   else
@@ -2361,15 +2369,17 @@ gtk_default_draw_box_gap (GtkStyle       *style,
                          (gdouble) width,
                          (gdouble) height);
 
-  gtk_render_frame_gap (context, cr,
-                        (gdouble) x,
-                        (gdouble) y,
-                        (gdouble) width,
-                        (gdouble) height,
-                        gap_side,
-                        (gdouble) gap_x,
-                        (gdouble) gap_x + gap_width);
 
+  if (shadow_type != GTK_SHADOW_NONE)
+    gtk_render_frame_gap (context, cr,
+			  (gdouble) x,
+			  (gdouble) y,
+			  (gdouble) width,
+			  (gdouble) height,
+			  gap_side,
+			  (gdouble) gap_x,
+			  (gdouble) gap_x + gap_width);
+  
   cairo_restore (cr);
   gtk_style_context_restore (context);
 }



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