[mutter] clutter/actor: Use priv->parent instead of public API sometimes
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/actor: Use priv->parent instead of public API sometimes
- Date: Tue, 19 May 2020 08:39:17 +0000 (UTC)
commit a7bf6322e30626bc93c62743dece5711b1ca6ccb
Author: Jonas Dreßler <verdre v0yd nl>
Date: Fri Mar 20 17:39:35 2020 +0100
clutter/actor: Use priv->parent instead of public API sometimes
The public API to get the parent actor, clutter_actor_get_parent() does
a type check whether the actor is actually a ClutterActor. In case of
_clutter_actor_apply_relative_transformation_matrix(), which is called
recursively and very often during the paint process, this type check
shows up with almost twice the amount of hits than the actual matrix
multiplication.
So use the parent pointer directly in some code paths that are executed
very often and avoid the expensive type checking there, we can do that
since both places are not public API.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1259
clutter/clutter/clutter-actor.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index aa152977b..d18028285 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -2792,7 +2792,7 @@ _clutter_actor_propagate_queue_redraw (ClutterActor *self,
if (stop)
break;
- self = clutter_actor_get_parent (self);
+ self = self->priv->parent;
}
}
@@ -3310,8 +3310,6 @@ _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
ClutterActor *ancestor,
CoglMatrix *matrix)
{
- ClutterActor *parent;
-
/* Note we terminate before ever calling stage->apply_transform()
* since that would conceptually be relative to the underlying
* window OpenGL coordinates so we'd need a special @ancestor
@@ -3319,10 +3317,9 @@ _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
if (self == ancestor)
return;
- parent = clutter_actor_get_parent (self);
-
- if (parent != NULL)
- _clutter_actor_apply_relative_transformation_matrix (parent, ancestor,
+ if (self->priv->parent != NULL)
+ _clutter_actor_apply_relative_transformation_matrix (self->priv->parent,
+ ancestor,
matrix);
_clutter_actor_apply_modelview_transform (self, matrix);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]