From 2e5980612bb0f27c1616960a5b4bcd3898af14c0 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 28 Nov 2011 13:08:57 +0000 Subject: [PATCH] offscreen-effect: Track the size of the actor separately Previously the offscreen effect was keeping track of the size of the texture so that it could detect when a different size is requested and create a new texture. However this breaks if a subclass overrides create_texture to make the texture bigger because in that case the size of the texture will always be different from the calculated size of the actor. This patch makes it also track the size of the fbo that was requested before being passed through create_texture() and it instead uses that to detect when a new FBO is needed. https://bugzilla.gnome.org/show_bug.cgi?id=665040 Reviewed-by: Emmanuele Bassi (cherry picked from commit a2774fb0dcce0c92036b69fb75092ec8dc80905d) --- clutter/clutter-offscreen-effect.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-offscreen-effect.c b/clutter/clutter-offscreen-effect.c index cf0d07c..071b415 100644 --- a/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter-offscreen-effect.c @@ -85,9 +85,17 @@ struct _ClutterOffscreenEffectPrivate gfloat x_offset; gfloat y_offset; + /* The size of the texture */ gfloat target_width; gfloat target_height; + /* This is the calculated size of the fbo before being passed + through create_texture(). This needs to be tracked separately so + that we can detect when a different size is calculated and + regenerate the fbo */ + int fbo_width; + int fbo_height; + gint old_opacity_override; /* The matrix that was current the last time the fbo was updated. We @@ -154,8 +162,8 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height) return FALSE; } - if (priv->target_width == fbo_width && - priv->target_height == fbo_height && + if (priv->fbo_width == fbo_width && + priv->fbo_height == fbo_height && priv->offscreen != COGL_INVALID_HANDLE) return TRUE; @@ -187,6 +195,9 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height) priv->target_width = cogl_texture_get_width (texture); priv->target_height = cogl_texture_get_height (texture); + priv->fbo_width = fbo_width; + priv->fbo_height = fbo_height; + if (priv->offscreen != COGL_INVALID_HANDLE) cogl_handle_unref (priv->offscreen); @@ -200,6 +211,8 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height) priv->target_width = 0; priv->target_height = 0; + priv->fbo_width = 0; + priv->fbo_height = 0; return FALSE; } -- 1.7.8.1