From d306b4bb7d7a9c8b0b02c7e940b66f51ec62e18d Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 3 Mar 2011 16:46:26 +0000 Subject: [PATCH] clutter-offscreen-effect: Preserve the old opacity override When removing the opacity override in the post_paint implementation, ClutterOffscreenEffect would always set the override back to -1. This ends up cancelling out the effect of any overrides from outer effects which means that if any actor has multiple effects attached then it would apply the opacity multiple times. To fix this, the effect now preserves the old value of the opacity override and restores that instead of setting -1. http://bugzilla.clutter-project.org/show_bug.cgi?id=2541 --- clutter/clutter-offscreen-effect.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-offscreen-effect.c b/clutter/clutter-offscreen-effect.c index 804a36288..be2c2d19a 100644 --- a/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter-offscreen-effect.c @@ -87,6 +87,8 @@ struct _ClutterOffscreenEffectPrivate gfloat target_width; gfloat target_height; + + gint old_opacity_override; }; G_DEFINE_ABSTRACT_TYPE (ClutterOffscreenEffect, @@ -296,6 +298,8 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect) * texture with the actor's paint opacity, so we need to do this to avoid * multiplying the opacity twice. */ + priv->old_opacity_override = + _clutter_actor_get_opacity_override (priv->actor); _clutter_actor_set_opacity_override (priv->actor, 0xff); return TRUE; @@ -354,8 +358,8 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect) cogl_matrix_translate (&modelview, priv->x_offset, priv->y_offset, 0.0f); cogl_set_modelview_matrix (&modelview); - /* Remove the opacity override */ - _clutter_actor_set_opacity_override (priv->actor, -1); + /* Restore the previous opacity override */ + _clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override); /* paint the target material; this is virtualized for * sub-classes that require special hand-holding