mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter/actor: avoid transform node for identity matrix
If the transform matrix is an identity, then positioning wont change and we can avoid creating the transform node altogether. This is based on a similar find in GTK today while reducing temporary allocations. This cuts the number of transforms created in clutter_actor_paint() by about half under light testing of GNOME Shell from 6.8% to 2.4% of allocations. Before: ALLOCATED TOTAL FUNCTION [ 20.4 MiB] [ 21.20%] clutter_actor_paint [ 11.0 MiB] [ 11.45%] clutter_paint_node_paint [ 6.6 MiB] [ 6.84%] clutter_transform_node_new [ 2.5 MiB] [ 2.61%] clutter_actor_node_new After: ALLOCATED TOTAL FUNCTION [ 33.4 MiB] [ 24.12%] clutter_actor_paint [ 26.2 MiB] [ 18.91%] clutter_paint_node_paint [ 3.4 MiB] [ 2.43%] clutter_actor_node_new [ 3.3 MiB] [ 2.41%] clutter_transform_node_new Allocation amounts will have differed due to different amounts of running time, but the % of allocations has now dropped below clutter_actor_node_new() which should be expected. https://gitlab.gnome.org/GNOME/mutter/issues/1056
This commit is contained in:
parent
44ae38599f
commit
d122b66abc
@ -3997,11 +3997,14 @@ clutter_actor_paint (ClutterActor *self,
|
||||
|
||||
clutter_actor_get_transform (self, &transform);
|
||||
|
||||
transform_node = clutter_transform_node_new (&transform);
|
||||
clutter_paint_node_add_child (transform_node, root_node);
|
||||
clutter_paint_node_unref (root_node);
|
||||
if (!cogl_matrix_is_identity (&transform))
|
||||
{
|
||||
transform_node = clutter_transform_node_new (&transform);
|
||||
clutter_paint_node_add_child (transform_node, root_node);
|
||||
clutter_paint_node_unref (root_node);
|
||||
|
||||
root_node = g_steal_pointer (&transform_node);
|
||||
root_node = g_steal_pointer (&transform_node);
|
||||
}
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
/* Catch when out-of-band transforms have been made by actors not as part
|
||||
|
Loading…
Reference in New Issue
Block a user