[gtk+/gtk-3-20] shadowsvalue: Don't draw invisible box shadows



commit bab6cb6d97150660ca2b3a19e1033bc6504cbb73
Author: Timm Bäder <mail baedert org>
Date:   Sat Apr 30 21:06:07 2016 +0200

    shadowsvalue: Don't draw invisible box shadows

 gtk/gtkcssshadowvalue.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 93b4dcf..35d3df7 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -516,6 +516,10 @@ _gtk_css_shadow_value_paint_layout (const GtkCssValue *shadow,
 {
   g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
 
+  /* We don't need to draw invisible shadows */
+  if (gtk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color)))
+    return;
+
   if (!cairo_has_current_point (cr))
     cairo_move_to (cr, 0, 0);
 
@@ -558,6 +562,10 @@ _gtk_css_shadow_value_paint_icon (const GtkCssValue *shadow,
 
   g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
 
+  /* We don't need to draw invisible shadows */
+  if (gtk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color)))
+    return;
+
   cairo_save (cr);
   pattern = cairo_pattern_reference (cairo_get_source (cr));
 
@@ -875,6 +883,10 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue   *shadow,
 
   g_return_if_fail (shadow->class == &GTK_CSS_VALUE_SHADOW);
 
+  /* We don't need to draw invisible shadows */
+  if (gtk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color)))
+    return;
+
   cairo_clip_extents (cr, &x1c, &y1c, &x2c, &y2c);
   if ((shadow->inset && !_gtk_rounded_box_intersects_rectangle (padding_box, x1c, y1c, x2c, y2c)) ||
       (!shadow->inset && _gtk_rounded_box_contains_rectangle (padding_box, x1c, y1c, x2c, y2c)))


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