mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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>
This commit is contained in:
parent
3f4bd0d9d4
commit
a2774fb0dc
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user