summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-11-28 13:08:57 +0000
committerNeil Roberts <neil@linux.intel.com>2011-11-28 15:42:35 +0000
commita2774fb0dcce0c92036b69fb75092ec8dc80905d (patch)
tree33965279b6cb3481badd4a3d95880b4bda8c3bfc
parent3f4bd0d9d4b619d8545a57ee6735eb136dacb1c4 (diff)
downloadclutter-a2774fb0dcce0c92036b69fb75092ec8dc80905d.tar.gz
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 <ebassi@linux.intel.com>
-rw-r--r--clutter/clutter-offscreen-effect.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/clutter/clutter-offscreen-effect.c b/clutter/clutter-offscreen-effect.c
index cf0d07c0f..071b4156f 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;
}