x11-tfp: Implement get_paint_volume virtual

One of the later changes made on the paint volume branch before merging
with master was to make paint volumes opt in only since we couldn't make
any safe assumptions about how custom actors may constrain their
painting. We added very conservative implementations for the existing
Clutter actors - including for ClutterTexture which
ClutterX11TexturePixmap is a sub-class of - but we were conservative to
the extent of explicitly checking the GType of the actor so we would
avoid making any assumptions about sub-classes. The upshot was that we
neglected to implement the get_paint_volume vfunc for
ClutterX11TexturePixmap.

This patch provides an implementation that simply reports the actor's
allocation as its paint volume. Also unlike for other core actors it
doesn't explicitly check the GType so we are assuming that all existing
sub-classes of ClutterX11TexturePixmap constrain their drawing to the
actor's transformed allocation. If anyone does want to draw outside the
allocation in future sub-classes, then they should also provide an
updated get_paint_volume implementation.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2349
This commit is contained in:
Robert Bragg 2010-09-30 02:00:24 +01:00
parent 83eb5ab88c
commit 18e3273fb1

View File

@ -304,6 +304,13 @@ free_damage_resources (ClutterX11TexturePixmap *texture)
}
}
static gboolean
clutter_x11_texture_pixmap_get_paint_volume (ClutterActor *self,
ClutterPaintVolume *volume)
{
return clutter_paint_volume_set_from_allocation (volume, self);
}
static void
clutter_x11_texture_pixmap_real_queue_damage_redraw (
ClutterX11TexturePixmap *texture,
@ -499,11 +506,14 @@ static void
clutter_x11_texture_pixmap_class_init (ClutterX11TexturePixmapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *pspec;
ClutterBackend *default_backend;
g_type_class_add_private (klass, sizeof (ClutterX11TexturePixmapPrivate));
actor_class->get_paint_volume = clutter_x11_texture_pixmap_get_paint_volume;
object_class->dispose = clutter_x11_texture_pixmap_dispose;
object_class->set_property = clutter_x11_texture_pixmap_set_property;
object_class->get_property = clutter_x11_texture_pixmap_get_property;