[gtk+] cssbgsizevalue: Avoid allocating new value if not needed
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] cssbgsizevalue: Avoid allocating new value if not needed
- Date: Thu, 21 Apr 2016 21:02:00 +0000 (UTC)
commit 2fc0d6a91a0723d0b6b26b838cba521d479fa652
Author: Benjamin Otte <otte redhat com>
Date: Thu Apr 21 22:28:14 2016 +0200
cssbgsizevalue: Avoid allocating new value if not needed
gtk/gtkcssbgsizevalue.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c
index b5da067..3e25ded 100644
--- a/gtk/gtkcssbgsizevalue.c
+++ b/gtk/gtkcssbgsizevalue.c
@@ -60,6 +60,16 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
if (value->y)
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style);
+ if (x == value->x && y == value->y)
+ {
+ if (x)
+ _gtk_css_value_unref (x);
+ if (y)
+ _gtk_css_value_unref (y);
+
+ return _gtk_css_value_ref (value);
+ }
+
return _gtk_css_bg_size_value_new (value->x ? x : NULL,
value->y ? y : NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]