[texture] split out fbo update code from cluter_texture_paint

To help keep clutter_texture_paint maintainable this splits out a big
chunk of standalone code that's responsible for updating the fbo when
clutter_texture_new_from_actor has been used.
This commit is contained in:
Robert Bragg 2009-09-24 14:34:09 +01:00
parent 2762e6d9b9
commit 94a6028358

View File

@ -512,29 +512,15 @@ clutter_texture_set_fbo_projection (ClutterActor *self)
}
static void
clutter_texture_paint (ClutterActor *self)
update_fbo (ClutterActor *self)
{
ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv;
ClutterActorBox box = { 0, };
CoglColor transparent_col;
gfloat t_w, t_h;
guint8 paint_opacity = clutter_actor_get_paint_opacity (self);
if (paint_opacity == 0)
{
/* Bail early if painting the actor would be a no-op, custom actors that
* might cause a lot of work/state changes should all do this.
*/
return;
}
if (priv->fbo_handle != COGL_INVALID_HANDLE)
{
ClutterMainContext *context;
ClutterShader *shader = NULL;
ClutterActor *stage = NULL;
ClutterPerspective perspective;
CoglColor transparent_col;
context = _clutter_context_get_default ();
@ -587,7 +573,7 @@ clutter_texture_paint (ClutterActor *self)
COGL_BUFFER_BIT_DEPTH);
cogl_disable_fog ();
/* Render out actor scene to fbo */
/* Render the actor to the fbo */
clutter_actor_paint (priv->fbo_source);
/* Restore drawing to the previous draw buffer */
@ -603,8 +589,28 @@ clutter_texture_paint (ClutterActor *self)
/* If there is a shader on top of the shader stack, turn it back on. */
if (shader)
clutter_shader_set_is_enabled (shader, TRUE);
}
static void
clutter_texture_paint (ClutterActor *self)
{
ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv;
ClutterActorBox box = { 0, };
gfloat t_w, t_h;
guint8 paint_opacity = clutter_actor_get_paint_opacity (self);
if (paint_opacity == 0)
{
/* Bail early if painting the actor would be a no-op, custom actors that
* might cause a lot of work/state changes should all do this.
*/
return;
}
if (priv->fbo_handle != COGL_INVALID_HANDLE)
update_fbo (self);
CLUTTER_NOTE (PAINT,
"painting texture '%s'",
clutter_actor_get_name (self) ? clutter_actor_get_name (self)