Skip to content

clutter/brightness-contrast-effect: Always update offscreened texture

Jonas Dreßler requested to merge verdre/mutter:fix-effect-flickering into master

When a ClutterEffect queues a redraw using clutter_effect_queue_repaint, ClutterActor will apply an optimization and doesn't set the CLUTTER_EFFECT_PAINT_ACTOR_DIRTY flag when calling the effect's repaint function so the effect knows that the texture of the actor didn't change. ClutterOffscreenEffect makes use of this optimization and directly uses its latest offscreened texture instead of calling clutter_actor_continue_paint to (unnecessarily) paint the actor again.

Now if the effect was disabled and is enabled again, the notify::enabled handler of ClutterEffect queues a full redraw of the actor, which, in case of ClutterOffscreenEffect, should trigger a full repaint of the actor and thus update the old offscreened texture. Now in case the effect in use is a ClutterBrightnessContrastEffect that has its properties set to apply no changes to the texture, the effect will bail out early inside clutter_brightness_contrast_effect_pre_paint before the texture is updated in the OffscreenEffect's pre_paint handler.

This causes a bug where the old texture that was stored before the effect was last disabed is shown during the BrightnessContrastEffect is animated in. That's because the first full repaint (queued from the notify::enabled handler) of the effect is missed because the effect won't be visible, and all following repaints are only caused by property-changes of the effect taking the fast path and using the available (outdated) offscreened texture directly.

Fix this bug by ignoring whether the effect will be visible or not, which makes sure the offscreened texture is always updated in case the effect is enabled.

Fixes #810 (closed)

Merge request reports