Wrap shader stack into private functions

The shader stack held by ClutterMainContext should only be accessed
using functions, and not directly.

Since it's a stack, we can use stack-like operations: push, pop and
peek.
This commit is contained in:
Emmanuele Bassi
2011-02-18 15:44:17 +00:00
parent 28b0f8b938
commit 2593bbaadc
4 changed files with 55 additions and 28 deletions

View File

@ -468,27 +468,26 @@ update_fbo (ClutterActor *self)
{
ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv;
ClutterMainContext *context;
ClutterActor *head;
ClutterShader *shader = NULL;
ClutterActor *stage = NULL;
CoglMatrix projection;
CoglColor transparent_col;
context = _clutter_context_get_default ();
head = _clutter_context_peek_shader_stack ();
if (head != NULL)
shader = clutter_actor_get_shader (head);
if (context->shaders)
shader = clutter_actor_get_shader (context->shaders->data);
/* Temporarily turn off the shader on the top of the context's shader stack,
* to restore the GL pipeline to it's natural state.
/* Temporarily turn off the shader on the top of the context's
* shader stack, to restore the GL pipeline to it's natural state.
*/
if (shader)
if (shader != NULL)
clutter_shader_set_is_enabled (shader, FALSE);
/* Redirect drawing to the fbo */
cogl_push_framebuffer (priv->fbo_handle);
if ((stage = clutter_actor_get_stage (self)))
if ((stage = clutter_actor_get_stage (self)) != NULL)
{
gfloat stage_width, stage_height;
ClutterActor *source_parent;
@ -554,7 +553,7 @@ update_fbo (ClutterActor *self)
cogl_pop_framebuffer ();
/* If there is a shader on top of the shader stack, turn it back on. */
if (shader)
if (shader != NULL)
clutter_shader_set_is_enabled (shader, TRUE);
}