effect: Allow any effect to override the paint volume

An Effect implementation might override the paint volume of the actor to
which it is applied to. The get_paint_volume() virtual function should
be added to the Effect class vtable so that any effect can get the
current paint volume and update it.

The clutter_actor_get_paint_volume() function becomes context aware, and
does the right thing if called from within a ClutterEffect pre_paint()
or post_paint() implementation, by allowing all effects in the chain up
to the caller to modify the paint volume.
This commit is contained in:
Emmanuele Bassi
2010-08-16 17:02:15 +01:00
committed by Robert Bragg
parent 94ce747f83
commit 25abdf09b7
4 changed files with 80 additions and 6 deletions

View File

@ -191,11 +191,18 @@ clutter_effect_real_post_paint (ClutterEffect *effect)
{
}
static void
clutter_effect_real_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
}
static void
clutter_effect_class_init (ClutterEffectClass *klass)
{
klass->pre_paint = clutter_effect_real_pre_paint;
klass->post_paint = clutter_effect_real_post_paint;
klass->get_paint_volume = clutter_effect_real_get_paint_volume;
}
static void
@ -218,3 +225,13 @@ _clutter_effect_post_paint (ClutterEffect *effect)
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect);
}
void
_clutter_effect_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
g_return_if_fail (volume != NULL);
CLUTTER_EFFECT_GET_CLASS (effect)->get_paint_volume (effect, volume);
}