#include "cogl-util.h"
#include "cogl-path-private.h"
+typedef struct _CoglClipStack CoglClipStack;
typedef struct _CoglClipStackEntry CoglClipStackEntry;
typedef struct _CoglClipStackEntryRect CoglClipStackEntryRect;
typedef struct _CoglClipStackEntryWindowRect CoglClipStackEntryWindowRect;
struct _CoglClipStack
{
+ CoglHandleObject _parent;
+
CoglClipStackEntry *stack_top;
};
CoglHandle path;
};
+static void _cogl_clip_stack_free (CoglClipStack *stack);
+
+COGL_HANDLE_DEFINE (ClipStack, clip_stack);
+
+#define COGL_CLIP_STACK(stack) ((CoglClipStack *) (stack))
+
static void
project_vertex (const CoglMatrix *modelview_matrix,
const CoglMatrix *projection_matrix,
}
void
-_cogl_clip_stack_push_window_rectangle (CoglClipStack *stack,
+_cogl_clip_stack_push_window_rectangle (CoglHandle handle,
int x_offset,
int y_offset,
int width,
int height)
{
+ CoglClipStack *stack = COGL_CLIP_STACK (handle);
CoglClipStackEntryWindowRect *entry;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
}
void
-_cogl_clip_stack_push_rectangle (CoglClipStack *stack,
+_cogl_clip_stack_push_rectangle (CoglHandle handle,
float x_1,
float y_1,
float x_2,
float y_2,
const CoglMatrix *modelview_matrix)
{
+ CoglClipStack *stack = COGL_CLIP_STACK (handle);
CoglClipStackEntryRect *entry;
/* Make a new entry */
}
void
-_cogl_clip_stack_push_from_path (CoglClipStack *stack,
+_cogl_clip_stack_push_from_path (CoglHandle handle,
CoglHandle path,
const CoglMatrix *modelview_matrix)
{
+ CoglClipStack *stack = COGL_CLIP_STACK (handle);
CoglClipStackEntryPath *entry;
entry = _cogl_clip_stack_push_entry (stack,
}
void
-_cogl_clip_stack_pop (CoglClipStack *stack)
+_cogl_clip_stack_pop (CoglHandle handle)
{
+ CoglClipStack *stack = COGL_CLIP_STACK (handle);
CoglClipStackEntry *entry;
g_return_if_fail (stack->stack_top != NULL);
}
void
-_cogl_clip_stack_flush (CoglClipStack *stack,
+_cogl_clip_stack_flush (CoglHandle handle,
gboolean *stencil_used_p)
{
+ CoglClipStack *stack = COGL_CLIP_STACK (handle);
int has_clip_planes;
gboolean using_clip_planes = FALSE;
gboolean using_stencil_buffer = FALSE;
*stencil_used_p = using_stencil_buffer;
}
-CoglClipStack *
+CoglHandle
_cogl_clip_stack_new (void)
{
CoglClipStack *stack;
stack = g_slice_new (CoglClipStack);
stack->stack_top = NULL;
- return stack;
+ return _cogl_clip_stack_handle_new (stack);
}
void
#ifndef __COGL_CLIP_STACK_H
#define __COGL_CLIP_STACK_H
-typedef struct _CoglClipStack CoglClipStack;
-
-CoglClipStack *
+CoglHandle
_cogl_clip_stack_new (void);
void
-_cogl_clip_stack_free (CoglClipStack *stack);
-
-void
-_cogl_clip_stack_push_window_rectangle (CoglClipStack *stack,
+_cogl_clip_stack_push_window_rectangle (CoglHandle handle,
int x_offset,
int y_offset,
int width,
int height);
void
-_cogl_clip_stack_push_rectangle (CoglClipStack *stack,
+_cogl_clip_stack_push_rectangle (CoglHandle handle,
float x_1,
float y_1,
float x_2,
const CoglMatrix *modelview_matrix);
void
-_cogl_clip_stack_push_from_path (CoglClipStack *stack,
+_cogl_clip_stack_push_from_path (CoglHandle handle,
CoglHandle path,
const CoglMatrix *modelview_matrix);
void
-_cogl_clip_stack_pop (CoglClipStack *stack);
+_cogl_clip_stack_pop (CoglHandle handle);
void
-_cogl_clip_stack_flush (CoglClipStack *stack,
+_cogl_clip_stack_flush (CoglHandle handle,
gboolean *stencil_used_p);
#endif /* __COGL_CLIP_STACK_H */
{
CoglHandle framebuffer;
CoglClipState *clip_state;
- CoglClipStack *stack;
+ CoglHandle stack;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
{
CoglHandle framebuffer;
CoglClipState *clip_state;
- CoglClipStack *stack;
+ CoglHandle stack;
CoglMatrix modelview_matrix;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
{
CoglHandle framebuffer;
CoglClipState *clip_state;
- CoglClipStack *stack;
+ CoglHandle stack;
CoglMatrix modelview_matrix;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
static void
_cogl_clip_pop_real (CoglClipState *clip_state)
{
- CoglClipStack *stack;
+ CoglHandle stack;
/* We don't log clip stack changes in the journal so we must flush
* it before making modifications */
void
_cogl_clip_state_flush (CoglClipState *clip_state)
{
- CoglClipStack *stack;
+ CoglHandle stack;
if (!clip_state->stack_dirty)
return;
static void
_cogl_clip_stack_save_real (CoglClipState *clip_state)
{
- CoglClipStack *stack;
+ CoglHandle stack;
/* We don't log clip stack changes in the journal so we must flush
* it before making modifications */
static void
_cogl_clip_stack_restore_real (CoglClipState *clip_state)
{
- CoglClipStack *stack;
+ CoglHandle stack;
g_return_if_fail (clip_state->stacks != NULL);
stack = clip_state->stacks->data;
- _cogl_clip_stack_free (stack);
+ cogl_handle_unref (stack);
/* Revert to an old stack */
clip_state->stacks = g_slist_delete_link (clip_state->stacks,