[gtk+/wip/shadows] css shadows: Exit early if clip is empty
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/shadows] css shadows: Exit early if clip is empty
- Date: Mon, 6 May 2013 14:18:13 +0000 (UTC)
commit e4ec818cbad4f0e3e4793b8142919aee92b393b7
Author: Alexander Larsson <alexl redhat com>
Date: Mon May 6 12:34:09 2013 +0200
css shadows: Exit early if clip is empty
gtk/gtkcssshadowvalue.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index cf533a1..7b6efdc 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -475,6 +475,15 @@ _gtk_css_shadow_value_get_geometry (const GtkCssValue *shadow,
*spread = _gtk_css_number_value_get (shadow->spread, 0);
}
+static gboolean
+has_empty_clip (cairo_t *cr)
+{
+ double x1, y1, x2, y2;
+
+ cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
+ return x1 == x2 && y1 == y2;
+}
+
static void
draw_shadow (const GtkCssValue *shadow,
cairo_t *cr,
@@ -483,6 +492,9 @@ draw_shadow (const GtkCssValue *shadow,
{
cairo_t *shadow_cr;
+ if (has_empty_clip (cr))
+ return;
+
shadow_cr = gtk_css_shadow_value_start_drawing (shadow, cr);
cairo_set_fill_rule (shadow_cr, CAIRO_FILL_RULE_EVEN_ODD);
@@ -530,6 +542,12 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
cairo_clip (cr);
}
+ if (has_empty_clip (cr))
+ {
+ cairo_restore (cr);
+ return;
+ }
+
box = *padding_box;
_gtk_rounded_box_move (&box, x, y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]