summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-04-29 13:43:33 +0200
committerCarlos Garnacho <carlosg@gnome.org>2018-06-28 16:45:04 +0200
commit5ec47d6700e0230ae24c00831bc1d65df7b02b99 (patch)
tree0f4c7da37129f3c0cc7860eed48763aa2c5bec08
parentba0ea4c4294ecf80ad4044e9f29ed3e4cf366e9a (diff)
downloadmutter-wip/carlosg/reuse-paint-volumes.tar.gz
ClutterActor: Preserve valid paint volumes till the next relayout/repaintwip/carlosg/reuse-paint-volumes
Cuts down approximately all paint volume calculations when there's windows that redraw frequently, but don't move. https://bugzilla.gnome.org/show_bug.cgi?id=782344
-rw-r--r--clutter/clutter/clutter-actor.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 3e00a11db..2ba61ba9e 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -840,6 +840,7 @@ struct _ClutterActorPrivate
guint needs_compute_expand : 1;
guint needs_x_expand : 1;
guint needs_y_expand : 1;
+ guint needs_paint_volume_update : 1;
};
enum
@@ -1504,6 +1505,8 @@ clutter_actor_real_map (ClutterActor *self)
CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
+ self->priv->needs_paint_volume_update = TRUE;
+
stage = _clutter_actor_get_stage_internal (self);
priv->pick_id = _clutter_stage_acquire_pick_id (CLUTTER_STAGE (stage), self);
@@ -2737,6 +2740,7 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
priv->needs_width_request = TRUE;
priv->needs_height_request = TRUE;
priv->needs_allocation = TRUE;
+ priv->needs_paint_volume_update = TRUE;
/* reset the cached size requests */
memset (priv->width_requests, 0,
@@ -8518,6 +8522,7 @@ clutter_actor_init (ClutterActor *self)
priv->needs_width_request = TRUE;
priv->needs_height_request = TRUE;
priv->needs_allocation = TRUE;
+ priv->needs_paint_volume_update = TRUE;
priv->cached_width_age = 1;
priv->cached_height_age = 1;
@@ -10084,6 +10089,9 @@ clutter_actor_allocate (ClutterActor *self,
return;
}
+ if (CLUTTER_ACTOR_IS_MAPPED (self))
+ self->priv->needs_paint_volume_update = TRUE;
+
if (!stage_allocation_changed)
{
/* If the actor didn't move but needs_allocation is set, we just
@@ -12972,6 +12980,9 @@ clutter_actor_add_child_internal (ClutterActor *self,
child->priv->needs_height_request = TRUE;
child->priv->needs_allocation = TRUE;
+ if (CLUTTER_ACTOR_IS_MAPPED (child))
+ child->priv->needs_paint_volume_update = TRUE;
+
/* we only queue a relayout here, because any possible
* redraw has already been queued either by show() or
* by our call to queue_redraw() above
@@ -17514,11 +17525,16 @@ _clutter_actor_get_paint_volume_mutable (ClutterActor *self)
priv = self->priv;
if (priv->paint_volume_valid)
- clutter_paint_volume_free (&priv->paint_volume);
+ {
+ if (!priv->needs_paint_volume_update)
+ return &priv->paint_volume;
+ clutter_paint_volume_free (&priv->paint_volume);
+ }
if (_clutter_actor_get_paint_volume_real (self, &priv->paint_volume))
{
priv->paint_volume_valid = TRUE;
+ priv->needs_paint_volume_update = FALSE;
return &priv->paint_volume;
}
else