#endif
#include "cogl.h"
+#include "cogl-object.h"
#include "cogl-internal.h"
#include "cogl-context.h"
#include "cogl-journal-private.h"
static void _cogl_path_free (CoglPath *path);
-COGL_HANDLE_DEFINE (Path, path);
+COGL_OBJECT_DEFINE (Path, path);
static void
_cogl_path_data_unref (CoglPathData *data)
}
void
-_cogl_add_path_to_stencil_buffer (CoglHandle path_handle,
+_cogl_add_path_to_stencil_buffer (CoglPath *path,
gboolean merge,
gboolean need_clear)
{
float bounds_h;
unsigned long enable_flags = COGL_ENABLE_VERTEX_ARRAY;
CoglHandle prev_source;
- CoglHandle framebuffer = _cogl_get_framebuffer ();
+ CoglFramebuffer *framebuffer = _cogl_get_framebuffer ();
CoglMatrixStack *modelview_stack =
_cogl_framebuffer_get_modelview_stack (framebuffer);
CoglMatrixStack *projection_stack =
_cogl_framebuffer_get_projection_stack (framebuffer);
- CoglPath *path;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
- path = COGL_PATH (path_handle);
-
/* We don't track changes to the stencil buffer in the journal
* so we need to flush any batched geometry first */
_cogl_journal_flush ();
_cogl_framebuffer_flush_state (framebuffer, 0);
/* Just setup a simple material that doesn't use texturing... */
- prev_source = cogl_handle_ref (ctx->source_material);
+ prev_source = cogl_object_ref (ctx->source_material);
cogl_set_source (ctx->stencil_material);
_cogl_material_flush_gl_state (ctx->source_material, NULL);
/* restore the original material */
cogl_set_source (prev_source);
- cogl_handle_unref (prev_source);
+ cogl_object_unref (prev_source);
}
static int
if (G_LIKELY (!(cogl_debug_flags & COGL_DEBUG_FORCE_SCANLINE_PATHS)) &&
cogl_features_available (COGL_FEATURE_STENCIL_BUFFER))
{
- CoglHandle framebuffer;
+ CoglFramebuffer *framebuffer;
CoglClipState *clip_state;
_cogl_journal_flush ();
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
- cogl_handle_unref (ctx->current_path);
+ cogl_object_unref (ctx->current_path);
ctx->current_path = _cogl_path_new ();
}
data->path_pen.y + y_3);
}
-CoglHandle
+CoglPath *
cogl_path_get (void)
{
_COGL_GET_CONTEXT (ctx, NULL);
}
void
-cogl_path_set (CoglHandle handle)
+cogl_path_set (CoglPath *path)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
- if (!cogl_is_path (handle))
+ if (!cogl_is_path (path))
return;
- /* Reference the new handle first in case it is the same as the old
- handle */
- cogl_handle_ref (handle);
- cogl_handle_unref (ctx->current_path);
- ctx->current_path = handle;
+ /* Reference the new object first in case it is the same as the old
+ object */
+ cogl_object_ref (path);
+ cogl_object_unref (ctx->current_path);
+ ctx->current_path = path;
}
-CoglHandle
+CoglPath *
_cogl_path_new (void)
{
CoglPath *path;
data->path_nodes = g_array_new (FALSE, FALSE, sizeof (CoglPathNode));
data->last_path = 0;
- return _cogl_path_handle_new (path);
+ return _cogl_path_object_new (path);
}
-CoglHandle
-cogl_path_copy (CoglHandle handle)
+CoglPath *
+cogl_path_copy (CoglPath *old_path)
{
- CoglPath *old_path, *new_path;
+ CoglPath *new_path;
_COGL_GET_CONTEXT (ctx, NULL);
- if (!cogl_is_path (handle))
- return COGL_INVALID_HANDLE;
-
- old_path = COGL_PATH (handle);
+ if (!cogl_is_path (old_path))
+ return NULL;
new_path = g_slice_new (CoglPath);
new_path->data = old_path->data;
new_path->data->ref_count++;
- return _cogl_path_handle_new (new_path);
+ return _cogl_path_object_new (new_path);
}
static void
* rather then in the absolute coordinates.
*/
+typedef struct _CoglPath CoglPath;
+
/**
* cogl_path_fill:
*
/**
* cogl_path_get:
*
- * Gets a handle to the current path. The path can later be used again
- * by calling cogl_path_set(). Note that the path isn't copied so if
- * you later call any functions to add to the path it will affect the
- * returned handle too. No reference is taken on the path so if you
- * want to retain it you should take your own reference with
- * cogl_handle_ref().
+ * Gets a pointer to the current path. The path can later be used
+ * again by calling cogl_path_set(). Note that the path isn't copied
+ * so if you later call any functions to add to the path it will
+ * affect the returned object too. No reference is taken on the path
+ * so if you want to retain it you should take your own reference with
+ * cogl_object_ref().
*
- * Return value: a handle to the current path.
+ * Return value: a pointer to the current path.
*
* Since: 1.4
*/
-CoglHandle
+CoglPath *
cogl_path_get (void);
/**
* cogl_path_set:
- * @handle: A %CoglHandle to a path
+ * @path: A #CoglPath object
*
- * Replaces the current path with @handle. A reference is taken on the
- * handle so if you no longer need the path you should unref with
- * cogl_handle_unref().
+ * Replaces the current path with @path. A reference is taken on the
+ * object so if you no longer need the path you should unref with
+ * cogl_object_unref().
*
* Since: 1.4
*/
void
-cogl_path_set (CoglHandle handle);
+cogl_path_set (CoglPath *path);
/**
* cogl_path_copy:
- * @handle: A %CoglHandle to a path
+ * @path: A #CoglPath object
*
- * Returns a new copy of the path in @handle. The new path has a
+ * Returns a new copy of the path in @path. The new path has a
* reference count of 1 so you should unref it with
- * cogl_handle_unref() if you no longer need it.
+ * cogl_object_unref() if you no longer need it.
*
* Internally the path will share the data until one of the paths is
* modified so copying paths should be relatively cheap.
*
- * Return value: a copy of the path in @handle.
+ * Return value: a copy of the path in @path.
*/
-CoglHandle
-cogl_path_copy (CoglHandle handle);
+CoglPath *
+cogl_path_copy (CoglPath *path);
G_END_DECLS
#endif /* __COGL_PATH_H__ */
+
int width,
int height)
{
- CoglHandle framebuffer;
+ CoglFramebuffer *framebuffer;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
void
cogl_get_viewport (float v[4])
{
- CoglHandle framebuffer;
+ CoglFramebuffer *framebuffer;
int viewport[4];
int i;
CoglPixelFormat format,
guint8 *pixels)
{
- CoglHandle framebuffer;
+ CoglFramebuffer *framebuffer;
int framebuffer_height;
int bpp;
CoglBitmap bmp;
CoglClipState *
_cogl_get_clip_state (void)
{
- CoglHandle framebuffer;
+ CoglFramebuffer *framebuffer;
framebuffer = _cogl_get_framebuffer ();
return _cogl_framebuffer_get_clip_state (framebuffer);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
- g_return_if_fail (texture_handle != COGL_INVALID_HANDLE);
+ g_return_if_fail (texture_handle != NULL);
cogl_material_set_layer (ctx->simple_material, 0, texture_handle);
cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);