St: Take advantage of clipped redraws

In order to take advantage of clipped redraws (only redraw the
parts that actually changed), we have to inform clutter about
our paint_volume by implementing the get_paint_volume virtual
method.

As this feature had been added in in clutter 1.5.x we now require
that.

https://bugzilla.gnome.org/show_bug.cgi?id=630932
This commit is contained in:
Adel Gadllah
2010-11-27 20:46:05 +01:00
committed by Owen W. Taylor
parent 41a5282b7e
commit 56fb7e2c58
4 changed files with 85 additions and 1 deletions

View File

@ -245,6 +245,34 @@ shell_generic_container_finalize (GObject *object)
G_OBJECT_CLASS (shell_generic_container_parent_class)->finalize (object);
}
/* Based on implementation from clutter-group.c */
static gboolean
shell_generic_container_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume)
{
GList *l, *children;
children = st_container_get_children_list (ST_CONTAINER (actor));
CLUTTER_ACTOR_CLASS (shell_generic_container_parent_class)->get_paint_volume (actor, volume);
for (l = children; l != NULL; l = l->next)
{
ClutterActor *child = l->data;
const ClutterPaintVolume *child_volume;
/* This gets the paint volume of the child transformed into the
* group's coordinate space... */
child_volume = clutter_actor_get_transformed_paint_volume (child, actor);
if (!child_volume)
return FALSE;
clutter_paint_volume_union (volume, child_volume);
}
return TRUE;
}
static void
shell_generic_container_class_init (ShellGenericContainerClass *klass)
{
@ -257,6 +285,7 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
actor_class->get_preferred_width = shell_generic_container_get_preferred_width;
actor_class->get_preferred_height = shell_generic_container_get_preferred_height;
actor_class->allocate = shell_generic_container_allocate;
actor_class->get_paint_volume = shell_generic_container_get_paint_volume;
actor_class->paint = shell_generic_container_paint;
actor_class->pick = shell_generic_container_pick;