diff options
author | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2020-01-07 11:58:54 -0300 |
---|---|---|
committer | Robert Mader <robert.mader@posteo.de> | 2020-02-02 17:31:46 +0100 |
commit | 47fe7ac25bf7ba85a5f03de8e30e9faa5b243f9c (patch) | |
tree | 9a511d4de46cad5e702bd13b6b1caa15e0f62c7e | |
parent | d35d7fb6189de9a40a1fdd8f8c03da4aba3983a3 (diff) | |
download | mutter-47fe7ac25bf7ba85a5f03de8e30e9faa5b243f9c.tar.gz |
clutter/offscreen-effect: Clear offscreen framebuffer when disabling
When changing the 'enabled' property and disabling the offscreen effect,
it doesn't make sense to preserve the offscreen framebuffer. It's not
drawing, after all.
Furthermore, because ClutterOffscreenEffect only checks if the offscreen
framebuffer exists to decide whether or not to redraw, keeping the fbo
alive is a waste of resources.
Clear the offscreen framebuffer when the effect is disabled or enabled.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/810
https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
(cherry picked from commit bf594e9fb6d973259163f73881dd91c8910dd54f)
-rw-r--r-- | clutter/clutter/clutter-offscreen-effect.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c index 02d0f4c06..12ab0f833 100644 --- a/clutter/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter/clutter-offscreen-effect.c @@ -468,6 +468,19 @@ clutter_offscreen_effect_paint (ClutterEffect *effect, } static void +clutter_offscreen_effect_notify (GObject *gobject, + GParamSpec *pspec) +{ + ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (gobject); + ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv; + + if (strcmp (pspec->name, "enabled") == 0) + g_clear_pointer (&priv->offscreen, cogl_object_unref); + + G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->notify (gobject, pspec); +} + +static void clutter_offscreen_effect_finalize (GObject *gobject) { ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject); @@ -497,6 +510,7 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass) effect_class->paint = clutter_offscreen_effect_paint; gobject_class->finalize = clutter_offscreen_effect_finalize; + gobject_class->notify = clutter_offscreen_effect_notify; } static void |