[mutter/gbsneto/offscreen-fix: 3/4] clutter/offscreen-effect: Clear offscreen when pre-paint fails
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/offscreen-fix: 3/4] clutter/offscreen-effect: Clear offscreen when pre-paint fails
- Date: Tue, 7 Jan 2020 17:03:05 +0000 (UTC)
commit 4afc5d0daa0e1bfa0b478eacf6ec476526e79802
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jan 7 13:17:56 2020 -0300
clutter/offscreen-effect: Clear offscreen when pre-paint fails
Some ClutterOffscreenEffect subclasses, such as ClutterBrightnessContrastEffect,
early-return FALSE in pre-paint before chaining up. It's an important optimization
that avoids creating or updating the offscreen framebuffer.
However, if an offscreen framebuffer already exists by the time pre-paint fails,
it will be used *without* repaint the actor over it. That causes an old picture
of the actor to be displayed.
Fix that by always clearing the offscreen framebuffer when pre-paint fails.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/810
https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
clutter/clutter/clutter-offscreen-effect.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c
index d83f0444a..89467e541 100644
--- a/clutter/clutter/clutter-offscreen-effect.c
+++ b/clutter/clutter/clutter-offscreen-effect.c
@@ -474,10 +474,17 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
*/
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
{
- /* Chain up to the parent paint method which will call the pre and
- post paint functions to update the image */
- CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class)->
- paint (effect, paint_context, flags);
+ ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect);
+ gboolean pre_paint_succeeded;
+
+ pre_paint_succeeded = effect_class->pre_paint (effect, paint_context);
+
+ clutter_actor_continue_paint (priv->actor, paint_context);
+
+ if (pre_paint_succeeded)
+ effect_class->post_paint (effect, paint_context);
+ else
+ g_clear_pointer (&priv->offscreen, cogl_object_unref);
}
else
clutter_offscreen_effect_paint_texture (self, paint_context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]