mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 02:20:43 -05:00
actor: Minor optimization to avoid get_preferred_*
When the easing state has a duration of zero milliseconds we can skip the entire create_transition() call inside set_width() and set_height(), to avoid what may be a costly call to get_preferred_*.
This commit is contained in:
parent
cede56dcdd
commit
ff9a503c14
@ -9473,7 +9473,25 @@ clutter_actor_set_width (ClutterActor *self,
|
||||
|
||||
if (_clutter_actor_get_transition (self, obj_props[PROP_WIDTH]) == NULL)
|
||||
{
|
||||
float cur_size = clutter_actor_get_width (self);
|
||||
float cur_size;
|
||||
|
||||
/* minor optimization: if we don't have a duration
|
||||
* then we can skip the get_width() below, to avoid
|
||||
* the chance of going through get_preferred_width()
|
||||
* just to jump to a new desired width.
|
||||
*/
|
||||
if (clutter_actor_get_easing_duration (self) == 0)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
clutter_actor_set_width_internal (self, width);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
cur_size = clutter_actor_get_width (self);
|
||||
|
||||
_clutter_actor_create_transition (self,
|
||||
obj_props[PROP_WIDTH],
|
||||
@ -9509,7 +9527,21 @@ clutter_actor_set_height (ClutterActor *self,
|
||||
|
||||
if (_clutter_actor_get_transition (self, obj_props[PROP_HEIGHT]) == NULL)
|
||||
{
|
||||
float cur_size = clutter_actor_get_height (self);
|
||||
float cur_size;
|
||||
|
||||
/* see the comment in clutter_actor_set_width() above */
|
||||
if (clutter_actor_get_easing_duration (self) == 0)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
clutter_actor_set_height_internal (self, height);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
cur_size = clutter_actor_get_height (self);
|
||||
|
||||
_clutter_actor_create_transition (self,
|
||||
obj_props[PROP_HEIGHT],
|
||||
|
Loading…
Reference in New Issue
Block a user