diff --git a/clutter/cogl/cogl/cogl-clip-state.c b/clutter/cogl/cogl/cogl-clip-state.c index 2efe2ec98..4e6adca8b 100644 --- a/clutter/cogl/cogl/cogl-clip-state.c +++ b/clutter/cogl/cogl/cogl-clip-state.c @@ -251,30 +251,15 @@ _cogl_clip_state_destroy (CoglClipState *clip_state) } CoglClipStack * -_cogl_get_clip_stack (void) +_cogl_clip_state_get_stack (CoglClipState *clip_state) { - CoglFramebuffer *framebuffer; - CoglClipState *clip_state; - - _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); - - framebuffer = _cogl_get_framebuffer (); - clip_state = _cogl_framebuffer_get_clip_state (framebuffer); - return clip_state->stacks->data; } void -_cogl_set_clip_stack (CoglClipStack *stack) +_cogl_clip_state_set_stack (CoglClipState *clip_state, + CoglClipStack *stack) { - CoglFramebuffer *framebuffer; - CoglClipState *clip_state; - - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - framebuffer = _cogl_get_framebuffer (); - clip_state = _cogl_framebuffer_get_clip_state (framebuffer); - /* Replace the top of the stack of stacks */ _cogl_clip_stack_ref (stack); _cogl_clip_stack_unref (clip_state->stacks->data); diff --git a/clutter/cogl/cogl/cogl-clip-state.h b/clutter/cogl/cogl/cogl-clip-state.h index 29cacfd23..23582735c 100644 --- a/clutter/cogl/cogl/cogl-clip-state.h +++ b/clutter/cogl/cogl/cogl-clip-state.h @@ -43,26 +43,11 @@ _cogl_clip_state_destroy (CoglClipState *state); void _cogl_clip_state_flush (CoglClipState *clip_state); -/* - * _cogl_get_clip_stack: - * - * Gets a pointer to the current clip stack. This can be used to later - * return to the same clip stack state with _cogl_set_clip_stack(). A - * reference is not taken on the stack so if you want to keep it you - * should call _cogl_clip_stack_ref(). - * - * Return value: a pointer to the current clip stack. - */ CoglClipStack * -_cogl_get_clip_stack (void); +_cogl_clip_state_get_stack (CoglClipState *clip_state); -/* - * _cogl_set_clip_stack: - * @stack: a pointer to the replacement clip stack - * - * Replaces the current clip stack with @stack. - */ void -_cogl_set_clip_stack (CoglClipStack *stack); +_cogl_clip_state_set_stack (CoglClipState *clip_state, + CoglClipStack *clip_stack); #endif /* __COGL_CLIP_STATE_H */ diff --git a/clutter/cogl/cogl/cogl-framebuffer-private.h b/clutter/cogl/cogl/cogl-framebuffer-private.h index 05199a8e1..0bfc64e61 100644 --- a/clutter/cogl/cogl/cogl-framebuffer-private.h +++ b/clutter/cogl/cogl/cogl-framebuffer-private.h @@ -126,6 +126,32 @@ _cogl_framebuffer_get_height (CoglFramebuffer *framebuffer); CoglClipState * _cogl_framebuffer_get_clip_state (CoglFramebuffer *framebuffer); +/* + * _cogl_framebuffer_get_clip_stack: + * @framebuffer: A #CoglFramebuffer + * + * Gets a pointer to the current clip stack. This can be used to later + * return to the same clip stack state with + * _cogl_framebuffer_set_clip_stack(). A reference is not taken on the + * stack so if you want to keep it you should call + * _cogl_clip_stack_ref(). + * + * Return value: a pointer to the @framebuffer clip stack. + */ +CoglClipStack * +_cogl_framebuffer_get_clip_stack (CoglFramebuffer *framebuffer); + +/* + * _cogl_framebuffer_set_clip_stack: + * @framebuffer: A #CoglFramebuffer + * @stack: a pointer to the replacement clip stack + * + * Replaces the @framebuffer clip stack with @stack. + */ +void +_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer, + CoglClipStack *stack); + void _cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer, int x, diff --git a/clutter/cogl/cogl/cogl-framebuffer.c b/clutter/cogl/cogl/cogl-framebuffer.c index 7a6a564e7..ede491e37 100644 --- a/clutter/cogl/cogl/cogl-framebuffer.c +++ b/clutter/cogl/cogl/cogl-framebuffer.c @@ -331,6 +331,23 @@ _cogl_framebuffer_get_clip_state (CoglFramebuffer *framebuffer) return &framebuffer->clip_state; } +CoglClipStack * +_cogl_framebuffer_get_clip_stack (CoglFramebuffer *framebuffer) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + + return _cogl_clip_state_get_stack (clip_state); +} + +void +_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer, + CoglClipStack *stack) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + + _cogl_clip_state_set_stack (clip_state, stack); +} + void _cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer, int x, diff --git a/clutter/cogl/cogl/cogl-journal.c b/clutter/cogl/cogl/cogl-journal.c index 783cdbda7..dc81e588a 100644 --- a/clutter/cogl/cogl/cogl-journal.c +++ b/clutter/cogl/cogl/cogl-journal.c @@ -1318,6 +1318,7 @@ _cogl_journal_log_quad (CoglJournal *journal, guint32 disable_layers; CoglJournalEntry *entry; CoglPipeline *source; + CoglClipStack *clip_stack; CoglPipelineFlushOptions flush_options; COGL_STATIC_TIMER (log_timer, "Mainloop", /* parent */ @@ -1413,7 +1414,9 @@ _cogl_journal_log_quad (CoglJournal *journal, } entry->pipeline = _cogl_pipeline_journal_ref (source); - entry->clip_stack = _cogl_clip_stack_ref (_cogl_get_clip_stack ()); + + clip_stack = _cogl_framebuffer_get_clip_stack (_cogl_get_framebuffer ()); + entry->clip_stack = _cogl_clip_stack_ref (clip_stack); if (G_UNLIKELY (source != pipeline)) cogl_handle_unref (source);