#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;
* For example, the following sequence of operations would generate
* the tree below:
*
- * CoglHandle stack_a = _cogl_clip_stack_new ();
+ * CoglClipStack *stack_a = _cogl_clip_stack_new ();
* _cogl_set_clip_stack (stack_a);
* cogl_clip_stack_push_rectangle (...);
* cogl_clip_stack_push_rectangle (...);
- * CoglHandle stack_b = _cogl_clip_stack_copy (stack_a);
+ * CoglClipStack *stack_b = _cogl_clip_stack_copy (stack_a);
* cogl_clip_stack_push_from_path ();
* cogl_set_clip_stack (stack_b);
* cogl_clip_stack_push_window_rectangle (...);
struct _CoglClipStack
{
- CoglHandleObject _parent;
+ CoglObject _parent;
CoglClipStackEntry *stack_top;
};
/* The matrix that was current when the clip was set */
CoglMatrix matrix;
- CoglHandle path;
+ CoglPath *path;
};
static void _cogl_clip_stack_free (CoglClipStack *stack);
-COGL_HANDLE_DEFINE (ClipStack, clip_stack);
+COGL_OBJECT_DEFINE (ClipStack, clip_stack);
#define COGL_CLIP_STACK(stack) ((CoglClipStack *) (stack))
GLdouble plane[4];
#endif
GLfloat angle;
- CoglHandle framebuffer = _cogl_get_framebuffer ();
+ CoglFramebuffer *framebuffer = _cogl_get_framebuffer ();
CoglMatrixStack *modelview_stack =
_cogl_framebuffer_get_modelview_stack (framebuffer);
CoglMatrixStack *projection_stack =
float x_2,
float y_2)
{
- CoglHandle framebuffer = _cogl_get_framebuffer ();
+ CoglFramebuffer *framebuffer = _cogl_get_framebuffer ();
CoglMatrixStack *modelview_stack =
_cogl_framebuffer_get_modelview_stack (framebuffer);
CoglMatrix modelview_matrix;
gboolean first)
{
CoglHandle current_source;
- CoglHandle framebuffer = _cogl_get_framebuffer ();
+ CoglFramebuffer *framebuffer = _cogl_get_framebuffer ();
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_cogl_framebuffer_flush_state (framebuffer, 0);
/* temporarily swap in our special stenciling material */
- current_source = cogl_handle_ref (ctx->source_material);
+ current_source = cogl_object_ref (ctx->source_material);
cogl_set_source (ctx->stencil_material);
if (first)
/* restore the original source material */
cogl_set_source (current_source);
- cogl_handle_unref (current_source);
+ cogl_object_unref (current_source);
}
static void
}
void
-_cogl_clip_stack_push_window_rectangle (CoglHandle handle,
+_cogl_clip_stack_push_window_rectangle (CoglClipStack *stack,
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 (CoglHandle handle,
+_cogl_clip_stack_push_rectangle (CoglClipStack *stack,
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 (CoglHandle handle,
- CoglHandle path,
+_cogl_clip_stack_push_from_path (CoglClipStack *stack,
+ CoglPath *path,
const CoglMatrix *modelview_matrix)
{
- CoglClipStack *stack = COGL_CLIP_STACK (handle);
CoglClipStackEntryPath *entry;
entry = _cogl_clip_stack_push_entry (stack,
break;
case COGL_CLIP_STACK_PATH:
- cogl_handle_unref (((CoglClipStackEntryPath *) entry)->path);
+ cogl_object_unref (((CoglClipStackEntryPath *) entry)->path);
g_slice_free1 (sizeof (CoglClipStackEntryPath), entry);
break;
}
void
-_cogl_clip_stack_pop (CoglHandle handle)
+_cogl_clip_stack_pop (CoglClipStack *stack)
{
- CoglClipStack *stack = COGL_CLIP_STACK (handle);
CoglClipStackEntry *entry;
g_return_if_fail (stack->stack_top != NULL);
}
void
-_cogl_clip_stack_flush (CoglHandle handle,
+_cogl_clip_stack_flush (CoglClipStack *stack,
gboolean *stencil_used_p)
{
- CoglClipStack *stack = COGL_CLIP_STACK (handle);
int has_clip_planes;
gboolean using_clip_planes = FALSE;
gboolean using_stencil_buffer = FALSE;
scissor_x0 = scissor_y0 = scissor_x1 = scissor_y1 = scissor_y_start = 0;
else
{
- CoglHandle framebuffer = _cogl_get_framebuffer ();
+ CoglFramebuffer *framebuffer = _cogl_get_framebuffer ();
/* We store the entry coordinates in Cogl coordinate space
* but OpenGL requires the window origin to be the bottom
*stencil_used_p = using_stencil_buffer;
}
-CoglHandle
+CoglClipStack *
_cogl_clip_stack_new (void)
{
CoglClipStack *stack;
stack = g_slice_new (CoglClipStack);
stack->stack_top = NULL;
- return _cogl_clip_stack_handle_new (stack);
+ return _cogl_clip_stack_object_new (stack);
}
void
g_slice_free (CoglClipStack, stack);
}
-CoglHandle
-_cogl_clip_stack_copy (CoglHandle handle)
+CoglClipStack *
+_cogl_clip_stack_copy (CoglClipStack *old_stack)
{
- CoglHandle new_handle;
- CoglClipStack *new_stack, *old_stack;
+ CoglClipStack *new_stack;
- if (!cogl_is_clip_stack (handle))
- return COGL_INVALID_HANDLE;
+ if (!cogl_is_clip_stack (old_stack))
+ return NULL;
- old_stack = COGL_CLIP_STACK (handle);
-
- new_handle = _cogl_clip_stack_new ();
- new_stack = COGL_CLIP_STACK (new_handle);
+ new_stack = _cogl_clip_stack_new ();
/* We can copy the stack by just referencing the other stack's
data. There's no need to implement copy-on-write because the
if (new_stack->stack_top)
new_stack->stack_top->ref_count++;
- return new_handle;
+ return new_stack;
}
#ifndef __COGL_CLIP_STACK_H
#define __COGL_CLIP_STACK_H
-CoglHandle
+typedef struct _CoglClipStack CoglClipStack;
+
+CoglClipStack *
_cogl_clip_stack_new (void);
void
-_cogl_clip_stack_push_window_rectangle (CoglHandle handle,
+_cogl_clip_stack_push_window_rectangle (CoglClipStack *stack,
int x_offset,
int y_offset,
int width,
int height);
void
-_cogl_clip_stack_push_rectangle (CoglHandle handle,
+_cogl_clip_stack_push_rectangle (CoglClipStack *stack,
float x_1,
float y_1,
float x_2,
const CoglMatrix *modelview_matrix);
void
-_cogl_clip_stack_push_from_path (CoglHandle handle,
- CoglHandle path,
+_cogl_clip_stack_push_from_path (CoglClipStack *stack,
+ CoglPath *path,
const CoglMatrix *modelview_matrix);
void
-_cogl_clip_stack_pop (CoglHandle handle);
+_cogl_clip_stack_pop (CoglClipStack *stack);
void
-_cogl_clip_stack_flush (CoglHandle handle,
+_cogl_clip_stack_flush (CoglClipStack *stack,
gboolean *stencil_used_p);
*/
/*
* _cogl_clip_stack_copy:
- * @handle: A handle to a clip stack
+ * @stack: A #CoglClipStack
*
- * Creates a copy of the given clip stack and returns a new handle to
+ * Creates a copy of the given clip stack and returns a new pointer to
* it. The data from the original stack is shared with the new stack
* so making copies is relatively cheap. Modifying the original stack
* does not affect the new stack.
*
- * Return value: a new clip stack with the same data as @handle
+ * Return value: a new clip stack with the same data as @stack
*/
-CoglHandle
-_cogl_clip_stack_copy (CoglHandle handle);
+CoglClipStack *
+_cogl_clip_stack_copy (CoglClipStack *stack);
#endif /* __COGL_CLIP_STACK_H */