stage: only update viewport when allocation changes

In clutter_stage_allocate at the end we were always querying the latest
allocation set and using the geometry to assert the viewport and then
kicking a full redraw. These only need to be done when the allocation
really changes, so we now read the previous allocation at the start of
the function and compare at the end. This was stopping clipped redraws
from being used in a lot of cases.
This commit is contained in:
Robert Bragg 2010-09-08 11:32:29 +01:00
parent 1e7f22db3b
commit 5d1600d603

View File

@ -232,6 +232,7 @@ clutter_stage_allocate (ClutterActor *self,
ClutterAllocationFlags flags)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterGeometry prev_geom;
ClutterGeometry geom = { 0, };
gboolean origin_changed;
gint width, height;
@ -241,6 +242,8 @@ clutter_stage_allocate (ClutterActor *self,
if (priv->impl == NULL)
return;
clutter_actor_get_allocation_geometry (self, &prev_geom);
width = clutter_actor_box_get_width (box);
height = clutter_actor_box_get_height (box);
_clutter_stage_window_get_geometry (priv->impl, &geom);
@ -321,13 +324,16 @@ clutter_stage_allocate (ClutterActor *self,
}
clutter_actor_get_allocation_geometry (self, &geom);
_clutter_stage_set_viewport (CLUTTER_STAGE (self),
0, 0, geom.width, geom.height);
if (geom.width != prev_geom.width || geom.height != prev_geom.height)
{
_clutter_stage_set_viewport (CLUTTER_STAGE (self),
0, 0, geom.width, geom.height);
/* Note: we don't assume that set_viewport will queue a full redraw
* since it may bail-out early if something preemptively set the
* viewport before the stage was really allocated its new size. */
queue_full_redraw (CLUTTER_STAGE (self));
/* Note: we don't assume that set_viewport will queue a full redraw
* since it may bail-out early if something preemptively set the
* viewport before the stage was really allocated its new size. */
queue_full_redraw (CLUTTER_STAGE (self));
}
}
/* This provides a common point of entry for painting the scenegraph