[mutter] clutter: Avoid redundant margin changes
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter: Avoid redundant margin changes
- Date: Wed, 30 Jan 2019 09:30:28 +0000 (UTC)
commit e0fd7a6d056c332129eefdf0bbfbfc690c12f607
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Thu Sep 20 11:47:24 2018 +0200
clutter: Avoid redundant margin changes
When profiling gnome-shell it was found that one of the main triggers
of `clutter_actor_queue_relayout` during animations was
`clutter_actor_set_margin_internal` continuously setting the same
zero margins. That's obviously pointless and also expensive. So just
avoid redundant margin changes.
This helps to further improve performance in:
https://gitlab.gnome.org/GNOME/mutter/issues/233,
https://gitlab.gnome.org/GNOME/gnome-shell/issues/349
This change previously landed as 59acb3895 and then got reverted because
it was found to make gnome-shell#517 worse. However that bug now has a
proper fix and this branch isn't really directly related so is being
reproposed...
clutter/clutter/clutter-actor.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 7de72e633..fd9aab289 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -18467,6 +18467,10 @@ clutter_actor_set_margin_top (ClutterActor *self,
g_return_if_fail (margin >= 0.f);
info = _clutter_actor_get_layout_info_or_defaults (self);
+
+ if (info->margin.top == margin)
+ return;
+
_clutter_actor_create_transition (self, obj_props[PROP_MARGIN_TOP],
info->margin.top,
margin);
@@ -18511,6 +18515,10 @@ clutter_actor_set_margin_bottom (ClutterActor *self,
g_return_if_fail (margin >= 0.f);
info = _clutter_actor_get_layout_info_or_defaults (self);
+
+ if (info->margin.bottom == margin)
+ return;
+
_clutter_actor_create_transition (self, obj_props[PROP_MARGIN_BOTTOM],
info->margin.bottom,
margin);
@@ -18555,6 +18563,10 @@ clutter_actor_set_margin_left (ClutterActor *self,
g_return_if_fail (margin >= 0.f);
info = _clutter_actor_get_layout_info_or_defaults (self);
+
+ if (info->margin.left == margin)
+ return;
+
_clutter_actor_create_transition (self, obj_props[PROP_MARGIN_LEFT],
info->margin.left,
margin);
@@ -18599,6 +18611,10 @@ clutter_actor_set_margin_right (ClutterActor *self,
g_return_if_fail (margin >= 0.f);
info = _clutter_actor_get_layout_info_or_defaults (self);
+
+ if (info->margin.right == margin)
+ return;
+
_clutter_actor_create_transition (self, obj_props[PROP_MARGIN_RIGHT],
info->margin.right,
margin);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]