mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
cogl: Remove cogl_handle_ref/unref
This is for all intents and purposes the same as `cogl_object_ref/unref`, but still refers to handles rather than objects (while we're trying to get rid of the former) so it's a bit of unnecessary redundant API. https://gitlab.gnome.org/GNOME/mutter/merge_requests/451
This commit is contained in:
parent
317ce05a27
commit
23f77a1b63
@ -100,13 +100,13 @@
|
|||||||
* // Clear the previous state //
|
* // Clear the previous state //
|
||||||
* if (self->rect_1)
|
* if (self->rect_1)
|
||||||
* {
|
* {
|
||||||
* cogl_handle_unref (self->rect_1);
|
* cogl_object_unref (self->rect_1);
|
||||||
* self->rect_1 = NULL;
|
* self->rect_1 = NULL;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* if (self->rect_2)
|
* if (self->rect_2)
|
||||||
* {
|
* {
|
||||||
* cogl_handle_unref (self->rect_2);
|
* cogl_object_unref (self->rect_2);
|
||||||
* self->rect_2 = NULL;
|
* self->rect_2 = NULL;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
|
@ -119,7 +119,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
|
|||||||
/* clear out the previous state */
|
/* clear out the previous state */
|
||||||
if (priv->offscreen != NULL)
|
if (priv->offscreen != NULL)
|
||||||
{
|
{
|
||||||
cogl_handle_unref (priv->offscreen);
|
cogl_object_unref (priv->offscreen);
|
||||||
priv->offscreen = NULL;
|
priv->offscreen = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,13 +199,13 @@ update_fbo (ClutterEffect *effect,
|
|||||||
|
|
||||||
if (priv->texture != NULL)
|
if (priv->texture != NULL)
|
||||||
{
|
{
|
||||||
cogl_handle_unref (priv->texture);
|
cogl_object_unref (priv->texture);
|
||||||
priv->texture = NULL;
|
priv->texture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->offscreen != NULL)
|
if (priv->offscreen != NULL)
|
||||||
{
|
{
|
||||||
cogl_handle_unref (priv->offscreen);
|
cogl_object_unref (priv->offscreen);
|
||||||
priv->offscreen = NULL;
|
priv->offscreen = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ update_fbo (ClutterEffect *effect,
|
|||||||
{
|
{
|
||||||
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
|
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
|
||||||
|
|
||||||
cogl_handle_unref (priv->target);
|
cogl_object_unref (priv->target);
|
||||||
priv->target = NULL;
|
priv->target = NULL;
|
||||||
|
|
||||||
priv->target_width = 0;
|
priv->target_width = 0;
|
||||||
@ -487,13 +487,13 @@ clutter_offscreen_effect_finalize (GObject *gobject)
|
|||||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||||
|
|
||||||
if (priv->offscreen)
|
if (priv->offscreen)
|
||||||
cogl_handle_unref (priv->offscreen);
|
cogl_object_unref (priv->offscreen);
|
||||||
|
|
||||||
if (priv->target)
|
if (priv->target)
|
||||||
cogl_handle_unref (priv->target);
|
cogl_object_unref (priv->target);
|
||||||
|
|
||||||
if (priv->texture)
|
if (priv->texture)
|
||||||
cogl_handle_unref (priv->texture);
|
cogl_object_unref (priv->texture);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
||||||
}
|
}
|
||||||
|
@ -179,14 +179,14 @@ clutter_shader_effect_clear (ClutterShaderEffect *self,
|
|||||||
|
|
||||||
if (priv->shader != COGL_INVALID_HANDLE)
|
if (priv->shader != COGL_INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
cogl_handle_unref (priv->shader);
|
cogl_object_unref (priv->shader);
|
||||||
|
|
||||||
priv->shader = COGL_INVALID_HANDLE;
|
priv->shader = COGL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->program != COGL_INVALID_HANDLE)
|
if (priv->program != COGL_INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
cogl_handle_unref (priv->program);
|
cogl_object_unref (priv->program);
|
||||||
|
|
||||||
priv->program = COGL_INVALID_HANDLE;
|
priv->program = COGL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
@ -387,10 +387,10 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->shader = cogl_handle_ref (class_priv->shader);
|
priv->shader = cogl_object_ref (class_priv->shader);
|
||||||
|
|
||||||
if (class_priv->program != COGL_INVALID_HANDLE)
|
if (class_priv->program != COGL_INVALID_HANDLE)
|
||||||
priv->program = cogl_handle_ref (class_priv->program);
|
priv->program = cogl_object_ref (class_priv->program);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ clutter_cairo_texture_create_surface (ClutterCairoTexture *self,
|
|||||||
cairo_stride,
|
cairo_stride,
|
||||||
cairo_data);
|
cairo_data);
|
||||||
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (self), cogl_texture);
|
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (self), cogl_texture);
|
||||||
cogl_handle_unref (cogl_texture);
|
cogl_object_unref (cogl_texture);
|
||||||
|
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
@ -1229,7 +1229,7 @@ clutter_texture_get_cogl_material (ClutterTexture *texture)
|
|||||||
* Replaces the underlying Cogl material drawn by this actor with
|
* Replaces the underlying Cogl material drawn by this actor with
|
||||||
* @cogl_material. A reference to the material is taken so if the
|
* @cogl_material. A reference to the material is taken so if the
|
||||||
* handle is no longer needed it should be deref'd with
|
* handle is no longer needed it should be deref'd with
|
||||||
* cogl_handle_unref. Texture data is attached to the material so
|
* cogl_object_unref. Texture data is attached to the material so
|
||||||
* calling this function also replaces the Cogl
|
* calling this function also replaces the Cogl
|
||||||
* texture. #ClutterTexture requires that the material have a texture
|
* texture. #ClutterTexture requires that the material have a texture
|
||||||
* layer so you should set one on the material before calling this
|
* layer so you should set one on the material before calling this
|
||||||
@ -1302,7 +1302,7 @@ get_first_layer_index (CoglPipeline *pipeline, int *layer_index)
|
|||||||
*
|
*
|
||||||
* Retrieves the handle to the underlying COGL texture used for drawing
|
* Retrieves the handle to the underlying COGL texture used for drawing
|
||||||
* the actor. No extra reference is taken so if you need to keep the
|
* the actor. No extra reference is taken so if you need to keep the
|
||||||
* handle then you should call cogl_handle_ref() on it.
|
* handle then you should call cogl_object_ref() on it.
|
||||||
*
|
*
|
||||||
* The texture handle returned is the first layer of the material
|
* The texture handle returned is the first layer of the material
|
||||||
* handle used by the #ClutterTexture. If you need to access the other
|
* handle used by the #ClutterTexture. If you need to access the other
|
||||||
@ -1342,7 +1342,7 @@ clutter_texture_get_cogl_texture (ClutterTexture *texture)
|
|||||||
*
|
*
|
||||||
* Replaces the underlying COGL texture drawn by this actor with
|
* Replaces the underlying COGL texture drawn by this actor with
|
||||||
* @cogl_tex. A reference to the texture is taken so if the handle is
|
* @cogl_tex. A reference to the texture is taken so if the handle is
|
||||||
* no longer needed it should be deref'd with cogl_handle_unref.
|
* no longer needed it should be deref'd with cogl_object_unref.
|
||||||
*
|
*
|
||||||
* Since: 0.8
|
* Since: 0.8
|
||||||
*
|
*
|
||||||
|
@ -432,7 +432,7 @@ _cogl_context_free (CoglContext *context)
|
|||||||
_cogl_free_framebuffer_stack (context->framebuffer_stack);
|
_cogl_free_framebuffer_stack (context->framebuffer_stack);
|
||||||
|
|
||||||
if (context->current_path)
|
if (context->current_path)
|
||||||
cogl_handle_unref (context->current_path);
|
cogl_object_unref (context->current_path);
|
||||||
|
|
||||||
if (context->default_gl_texture_2d_tex)
|
if (context->default_gl_texture_2d_tex)
|
||||||
cogl_object_unref (context->default_gl_texture_2d_tex);
|
cogl_object_unref (context->default_gl_texture_2d_tex);
|
||||||
|
@ -253,7 +253,7 @@ cogl_##type_name##_ref (void *object) \
|
|||||||
\
|
\
|
||||||
_COGL_OBJECT_DEBUG_REF (TypeName, object); \
|
_COGL_OBJECT_DEBUG_REF (TypeName, object); \
|
||||||
\
|
\
|
||||||
cogl_handle_ref (object); \
|
cogl_object_ref (object); \
|
||||||
\
|
\
|
||||||
return object; \
|
return object; \
|
||||||
} \
|
} \
|
||||||
@ -271,7 +271,7 @@ cogl_##type_name##_unref (void *object) \
|
|||||||
\
|
\
|
||||||
_COGL_OBJECT_DEBUG_UNREF (TypeName, object); \
|
_COGL_OBJECT_DEBUG_UNREF (TypeName, object); \
|
||||||
\
|
\
|
||||||
cogl_handle_unref (object); \
|
cogl_object_unref (object); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COGL_OBJECT_DEFINE(TypeName, type_name) \
|
#define COGL_OBJECT_DEFINE(TypeName, type_name) \
|
||||||
|
@ -52,12 +52,6 @@ cogl_object_ref (void *object)
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglHandle
|
|
||||||
cogl_handle_ref (CoglHandle handle)
|
|
||||||
{
|
|
||||||
return cogl_object_ref (handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_object_default_unref (void *object)
|
_cogl_object_default_unref (void *object)
|
||||||
{
|
{
|
||||||
@ -115,12 +109,6 @@ cogl_object_unref (void *obj)
|
|||||||
unref_func (obj);
|
unref_func (obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cogl_handle_unref (CoglHandle handle)
|
|
||||||
{
|
|
||||||
cogl_object_unref (handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
GType
|
||||||
cogl_handle_get_type (void)
|
cogl_handle_get_type (void)
|
||||||
{
|
{
|
||||||
|
@ -1131,10 +1131,10 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (program != COGL_INVALID_HANDLE)
|
if (program != COGL_INVALID_HANDLE)
|
||||||
cogl_handle_ref (program);
|
cogl_object_ref (program);
|
||||||
if (authority == pipeline &&
|
if (authority == pipeline &&
|
||||||
pipeline->big_state->user_program != COGL_INVALID_HANDLE)
|
pipeline->big_state->user_program != COGL_INVALID_HANDLE)
|
||||||
cogl_handle_unref (pipeline->big_state->user_program);
|
cogl_object_unref (pipeline->big_state->user_program);
|
||||||
pipeline->big_state->user_program = program;
|
pipeline->big_state->user_program = program;
|
||||||
|
|
||||||
pipeline->dirty_real_blend_enable = TRUE;
|
pipeline->dirty_real_blend_enable = TRUE;
|
||||||
|
@ -435,7 +435,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
|
|||||||
|
|
||||||
if (pipeline->differences & COGL_PIPELINE_STATE_USER_SHADER &&
|
if (pipeline->differences & COGL_PIPELINE_STATE_USER_SHADER &&
|
||||||
pipeline->big_state->user_program)
|
pipeline->big_state->user_program)
|
||||||
cogl_handle_unref (pipeline->big_state->user_program);
|
cogl_object_unref (pipeline->big_state->user_program);
|
||||||
|
|
||||||
if (pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS)
|
if (pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS)
|
||||||
{
|
{
|
||||||
@ -990,7 +990,7 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
|
|||||||
{
|
{
|
||||||
if (src->big_state->user_program)
|
if (src->big_state->user_program)
|
||||||
big_state->user_program =
|
big_state->user_program =
|
||||||
cogl_handle_ref (src->big_state->user_program);
|
cogl_object_ref (src->big_state->user_program);
|
||||||
else
|
else
|
||||||
big_state->user_program = COGL_INVALID_HANDLE;
|
big_state->user_program = COGL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
@ -92,27 +92,6 @@ typedef void * CoglHandle;
|
|||||||
GType
|
GType
|
||||||
cogl_handle_get_type (void) G_GNUC_CONST;
|
cogl_handle_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_handle_ref:
|
|
||||||
* @handle: a #CoglHandle
|
|
||||||
*
|
|
||||||
* Increases the reference count of @handle by 1
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): the handle, with its reference count increased
|
|
||||||
*/
|
|
||||||
CoglHandle
|
|
||||||
cogl_handle_ref (CoglHandle handle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_handle_unref:
|
|
||||||
* @handle: a #CoglHandle
|
|
||||||
*
|
|
||||||
* Drecreases the reference count of @handle by 1; if the reference
|
|
||||||
* count reaches 0, the resources allocated by @handle will be freed
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
cogl_handle_unref (CoglHandle handle);
|
|
||||||
|
|
||||||
/* We forward declare this in cogl-types to avoid circular dependencies
|
/* We forward declare this in cogl-types to avoid circular dependencies
|
||||||
* between cogl-matrix.h, cogl-euler.h and cogl-quaterion.h */
|
* between cogl-matrix.h, cogl-euler.h and cogl-quaterion.h */
|
||||||
typedef struct _CoglMatrix CoglMatrix;
|
typedef struct _CoglMatrix CoglMatrix;
|
||||||
|
@ -340,8 +340,6 @@ cogl_gtype_matrix_get_type
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
cogl_handle_get_type
|
cogl_handle_get_type
|
||||||
cogl_handle_ref
|
|
||||||
cogl_handle_unref
|
|
||||||
|
|
||||||
cogl_has_feature
|
cogl_has_feature
|
||||||
cogl_has_features
|
cogl_has_features
|
||||||
|
@ -60,7 +60,7 @@ _cogl_program_free (CoglProgram *program)
|
|||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
/* Unref all of the attached shaders and destroy the list */
|
/* Unref all of the attached shaders and destroy the list */
|
||||||
g_slist_free_full (program->attached_shaders, cogl_handle_unref);
|
g_slist_free_full (program->attached_shaders, cogl_object_unref);
|
||||||
|
|
||||||
for (i = 0; i < program->custom_uniforms->len; i++)
|
for (i = 0; i < program->custom_uniforms->len; i++)
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ cogl_program_attach_shader (CoglHandle program_handle,
|
|||||||
|
|
||||||
program->attached_shaders
|
program->attached_shaders
|
||||||
= g_slist_prepend (program->attached_shaders,
|
= g_slist_prepend (program->attached_shaders,
|
||||||
cogl_handle_ref (shader_handle));
|
cogl_object_ref (shader_handle));
|
||||||
|
|
||||||
program->age++;
|
program->age++;
|
||||||
}
|
}
|
||||||
@ -140,9 +140,9 @@ cogl_program_use (CoglHandle handle)
|
|||||||
ctx->legacy_state_set--;
|
ctx->legacy_state_set--;
|
||||||
|
|
||||||
if (handle != COGL_INVALID_HANDLE)
|
if (handle != COGL_INVALID_HANDLE)
|
||||||
cogl_handle_ref (handle);
|
cogl_object_ref (handle);
|
||||||
if (ctx->current_program != COGL_INVALID_HANDLE)
|
if (ctx->current_program != COGL_INVALID_HANDLE)
|
||||||
cogl_handle_unref (ctx->current_program);
|
cogl_object_unref (ctx->current_program);
|
||||||
ctx->current_program = handle;
|
ctx->current_program = handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1769,7 +1769,7 @@ cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices)
|
|||||||
if (ctx->quad_buffer_indices &&
|
if (ctx->quad_buffer_indices &&
|
||||||
ctx->quad_buffer_indices_len < n_indices)
|
ctx->quad_buffer_indices_len < n_indices)
|
||||||
{
|
{
|
||||||
cogl_handle_unref (ctx->quad_buffer_indices);
|
cogl_object_unref (ctx->quad_buffer_indices);
|
||||||
ctx->quad_buffer_indices = COGL_INVALID_HANDLE;
|
ctx->quad_buffer_indices = COGL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ test_blend_paint (TestState *state,
|
|||||||
y * QUAD_WIDTH,
|
y * QUAD_WIDTH,
|
||||||
x * QUAD_WIDTH + QUAD_WIDTH,
|
x * QUAD_WIDTH + QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH + QUAD_WIDTH);
|
y * QUAD_WIDTH + QUAD_WIDTH);
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now blend a rectangle over our well defined destination:
|
* Now blend a rectangle over our well defined destination:
|
||||||
@ -168,7 +168,7 @@ test_blend_paint (TestState *state,
|
|||||||
y * QUAD_WIDTH,
|
y * QUAD_WIDTH,
|
||||||
x * QUAD_WIDTH + QUAD_WIDTH,
|
x * QUAD_WIDTH + QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH + QUAD_WIDTH);
|
y * QUAD_WIDTH + QUAD_WIDTH);
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
|
|
||||||
/* See what we got... */
|
/* See what we got... */
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ test_tex_combine (TestState *state,
|
|||||||
x * QUAD_WIDTH + QUAD_WIDTH,
|
x * QUAD_WIDTH + QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH + QUAD_WIDTH);
|
y * QUAD_WIDTH + QUAD_WIDTH);
|
||||||
|
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
cogl_object_unref (tex0);
|
cogl_object_unref (tex0);
|
||||||
cogl_object_unref (tex1);
|
cogl_object_unref (tex1);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ paint_legacy (TestState *state)
|
|||||||
cogl_program_attach_shader (program, shader);
|
cogl_program_attach_shader (program, shader);
|
||||||
cogl_program_link (program);
|
cogl_program_link (program);
|
||||||
|
|
||||||
cogl_handle_unref (shader);
|
cogl_object_unref (shader);
|
||||||
|
|
||||||
/* Draw something using the material */
|
/* Draw something using the material */
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
@ -93,8 +93,8 @@ paint_legacy (TestState *state)
|
|||||||
cogl_rectangle (50, 0, 100, 50);
|
cogl_rectangle (50, 0, 100, 50);
|
||||||
cogl_program_use (COGL_INVALID_HANDLE);
|
cogl_program_use (COGL_INVALID_HANDLE);
|
||||||
|
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
cogl_handle_unref (program);
|
cogl_object_unref (program);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -152,7 +152,7 @@ paint (TestState *state)
|
|||||||
cogl_program_attach_shader (program, shader);
|
cogl_program_attach_shader (program, shader);
|
||||||
cogl_program_link (program);
|
cogl_program_link (program);
|
||||||
|
|
||||||
cogl_handle_unref (shader);
|
cogl_object_unref (shader);
|
||||||
|
|
||||||
/* Draw something without the program */
|
/* Draw something without the program */
|
||||||
cogl_set_source (pipeline);
|
cogl_set_source (pipeline);
|
||||||
@ -160,7 +160,7 @@ paint (TestState *state)
|
|||||||
|
|
||||||
/* Draw it again using the program. It should look exactly the same */
|
/* Draw it again using the program. It should look exactly the same */
|
||||||
cogl_pipeline_set_user_program (pipeline, program);
|
cogl_pipeline_set_user_program (pipeline, program);
|
||||||
cogl_handle_unref (program);
|
cogl_object_unref (program);
|
||||||
|
|
||||||
cogl_rectangle (50, 0, 100, 50);
|
cogl_rectangle (50, 0, 100, 50);
|
||||||
cogl_pipeline_set_user_program (pipeline, COGL_INVALID_HANDLE);
|
cogl_pipeline_set_user_program (pipeline, COGL_INVALID_HANDLE);
|
||||||
|
@ -68,7 +68,7 @@ test_material_with_primitives (TestState *state,
|
|||||||
COGL_VERTICES_MODE_TRIANGLE_FAN,
|
COGL_VERTICES_MODE_TRIANGLE_FAN,
|
||||||
0, /* first */
|
0, /* first */
|
||||||
4); /* count */
|
4); /* count */
|
||||||
cogl_handle_unref (vbo);
|
cogl_object_unref (vbo);
|
||||||
|
|
||||||
cogl_pop_matrix ();
|
cogl_pop_matrix ();
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ test_invalid_texture_layers (TestState *state, int x, int y)
|
|||||||
|
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
|
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
|
|
||||||
/* We expect a white fallback material to be used */
|
/* We expect a white fallback material to be used */
|
||||||
test_material_with_primitives (state, x, y, 0xffffffff);
|
test_material_with_primitives (state, x, y, 0xffffffff);
|
||||||
@ -156,9 +156,9 @@ test_using_all_layers (TestState *state, int x, int y)
|
|||||||
|
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
|
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
cogl_handle_unref (white_texture);
|
cogl_object_unref (white_texture);
|
||||||
cogl_handle_unref (red_texture);
|
cogl_object_unref (red_texture);
|
||||||
|
|
||||||
/* We expect the final fragment to be red */
|
/* We expect the final fragment to be red */
|
||||||
test_material_with_primitives (state, x, y, 0xff0000ff);
|
test_material_with_primitives (state, x, y, 0xff0000ff);
|
||||||
@ -184,7 +184,7 @@ test_invalid_texture_layers_with_constant_colors (TestState *state,
|
|||||||
|
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
|
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
|
|
||||||
/* We expect the final fragments to be green */
|
/* We expect the final fragments to be green */
|
||||||
test_material_with_primitives (state, x, y, 0x0000ffff);
|
test_material_with_primitives (state, x, y, 0x0000ffff);
|
||||||
|
@ -149,9 +149,9 @@ on_paint (ClutterActor *actor, TestState *state)
|
|||||||
cogl_rectangle_with_multitexture_coords (0, 0, QUAD_WIDTH, QUAD_WIDTH,
|
cogl_rectangle_with_multitexture_coords (0, 0, QUAD_WIDTH, QUAD_WIDTH,
|
||||||
tex_coords, 8);
|
tex_coords, 8);
|
||||||
|
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
cogl_handle_unref (tex0);
|
cogl_object_unref (tex0);
|
||||||
cogl_handle_unref (tex1);
|
cogl_object_unref (tex1);
|
||||||
|
|
||||||
/* See what we got... */
|
/* See what we got... */
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ create_pipeline_for_shader (TestState *state, const char *shader_source)
|
|||||||
|
|
||||||
cogl_pipeline_set_user_program (pipeline, program);
|
cogl_pipeline_set_user_program (pipeline, program);
|
||||||
|
|
||||||
cogl_handle_unref (shader);
|
cogl_object_unref (shader);
|
||||||
cogl_handle_unref (program);
|
cogl_object_unref (program);
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ on_paint (ClutterActor *actor, void *state)
|
|||||||
g_free (pixels);
|
g_free (pixels);
|
||||||
|
|
||||||
cogl_pop_framebuffer ();
|
cogl_pop_framebuffer ();
|
||||||
cogl_handle_unref (offscreen);
|
cogl_object_unref (offscreen);
|
||||||
|
|
||||||
/* Now verify reading back from an onscreen framebuffer...
|
/* Now verify reading back from an onscreen framebuffer...
|
||||||
*/
|
*/
|
||||||
@ -122,7 +122,7 @@ on_paint (ClutterActor *actor, void *state)
|
|||||||
|
|
||||||
g_free (pixelsc);
|
g_free (pixelsc);
|
||||||
|
|
||||||
cogl_handle_unref (tex);
|
cogl_object_unref (tex);
|
||||||
|
|
||||||
/* Restore the viewport and matrices state */
|
/* Restore the viewport and matrices state */
|
||||||
cogl_set_viewport (saved_viewport[0],
|
cogl_set_viewport (saved_viewport[0],
|
||||||
|
@ -54,7 +54,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
|||||||
tex = make_texture ();
|
tex = make_texture ();
|
||||||
material = cogl_material_new ();
|
material = cogl_material_new ();
|
||||||
cogl_material_set_layer (material, 0, tex);
|
cogl_material_set_layer (material, 0, tex);
|
||||||
cogl_handle_unref (tex);
|
cogl_object_unref (tex);
|
||||||
|
|
||||||
/* Render a 1x1 pixel quad without mipmaps */
|
/* Render a 1x1 pixel quad without mipmaps */
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
@ -68,7 +68,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
|||||||
COGL_MATERIAL_FILTER_NEAREST);
|
COGL_MATERIAL_FILTER_NEAREST);
|
||||||
cogl_rectangle (1, 0, 2, 1);
|
cogl_rectangle (1, 0, 2, 1);
|
||||||
|
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
|
|
||||||
/* Read back the two pixels we rendered */
|
/* Read back the two pixels we rendered */
|
||||||
cogl_read_pixels (0, 0, 2, 1,
|
cogl_read_pixels (0, 0, 2, 1,
|
||||||
|
@ -149,12 +149,12 @@ draw_frame (TestState *state)
|
|||||||
/* Flush the rendering now so we can safely delete the texture */
|
/* Flush the rendering now so we can safely delete the texture */
|
||||||
cogl_flush ();
|
cogl_flush ();
|
||||||
|
|
||||||
cogl_handle_unref (material_rect);
|
cogl_object_unref (material_rect);
|
||||||
|
|
||||||
/* Cogl doesn't destroy foreign textures so we have to do it manually */
|
/* Cogl doesn't destroy foreign textures so we have to do it manually */
|
||||||
cogl_texture_get_gl_texture (tex_rect, &gl_tex, NULL);
|
cogl_texture_get_gl_texture (tex_rect, &gl_tex, NULL);
|
||||||
glDeleteTextures (1, &gl_tex);
|
glDeleteTextures (1, &gl_tex);
|
||||||
cogl_handle_unref (tex_rect);
|
cogl_object_unref (tex_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -245,9 +245,9 @@ test_vertex_buffer_contiguous (TestUtilsGTestFixture *fixture,
|
|||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
cogl_handle_unref (state.buffer);
|
cogl_object_unref (state.buffer);
|
||||||
cogl_handle_unref (state.material);
|
cogl_object_unref (state.material);
|
||||||
cogl_handle_unref (state.texture);
|
cogl_object_unref (state.texture);
|
||||||
|
|
||||||
g_source_remove (idle_source);
|
g_source_remove (idle_source);
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ test_vertex_buffer_interleved (TestUtilsGTestFixture *fixture,
|
|||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
cogl_handle_unref (state.buffer);
|
cogl_object_unref (state.buffer);
|
||||||
|
|
||||||
g_source_remove (idle_source);
|
g_source_remove (idle_source);
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ test_vertex_buffer_mutability (TestUtilsGTestFixture *fixture,
|
|||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
cogl_handle_unref (state.buffer);
|
cogl_object_unref (state.buffer);
|
||||||
|
|
||||||
g_source_remove (idle_source);
|
g_source_remove (idle_source);
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ on_paint (ClutterActor *actor, void *state)
|
|||||||
cogl_set_viewport (0, 0, 10, 10);
|
cogl_set_viewport (0, 0, 10, 10);
|
||||||
|
|
||||||
cogl_pop_framebuffer ();
|
cogl_pop_framebuffer ();
|
||||||
cogl_handle_unref (offscreen);
|
cogl_object_unref (offscreen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify that the previous onscreen framebuffer's viewport was restored
|
* Verify that the previous onscreen framebuffer's viewport was restored
|
||||||
@ -361,7 +361,7 @@ on_paint (ClutterActor *actor, void *state)
|
|||||||
cogl_rectangle (-1, 1, 1, -1);
|
cogl_rectangle (-1, 1, 1, -1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cogl_handle_unref (tex);
|
cogl_object_unref (tex);
|
||||||
|
|
||||||
/* Finally restore the stage's original state... */
|
/* Finally restore the stage's original state... */
|
||||||
cogl_pop_matrix ();
|
cogl_pop_matrix ();
|
||||||
|
@ -173,7 +173,7 @@ draw_tests_vbo (TestState *state)
|
|||||||
cogl_pop_matrix ();
|
cogl_pop_matrix ();
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_handle_unref (vbo);
|
cogl_object_unref (vbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -225,12 +225,12 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
|||||||
|
|
||||||
clutter_main();
|
clutter_main();
|
||||||
|
|
||||||
cogl_handle_unref (state->material1);
|
cogl_object_unref (state->material1);
|
||||||
cogl_handle_unref (state->material0);
|
cogl_object_unref (state->material0);
|
||||||
cogl_handle_unref (state->alpha_tex);
|
cogl_object_unref (state->alpha_tex);
|
||||||
cogl_handle_unref (state->redhand_tex);
|
cogl_object_unref (state->redhand_tex);
|
||||||
cogl_handle_unref (state->light_tex0);
|
cogl_object_unref (state->light_tex0);
|
||||||
cogl_handle_unref (state->light_tex1);
|
cogl_object_unref (state->light_tex1);
|
||||||
g_free (state);
|
g_free (state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -133,8 +133,8 @@ test_coglbox_dispose (GObject *object)
|
|||||||
|
|
||||||
priv = TEST_COGLBOX_GET_PRIVATE (object);
|
priv = TEST_COGLBOX_GET_PRIVATE (object);
|
||||||
|
|
||||||
cogl_handle_unref (priv->texture_id);
|
cogl_object_unref (priv->texture_id);
|
||||||
cogl_handle_unref (priv->offscreen_id);
|
cogl_object_unref (priv->offscreen_id);
|
||||||
|
|
||||||
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
|
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ paint_cb (ClutterActor *stage, Data *data)
|
|||||||
cogl_set_source (data->material);
|
cogl_set_source (data->material);
|
||||||
cogl_vertex_buffer_draw (vbo, COGL_VERTICES_MODE_POINTS, 0, N_SPARKS);
|
cogl_vertex_buffer_draw (vbo, COGL_VERTICES_MODE_POINTS, 0, N_SPARKS);
|
||||||
|
|
||||||
cogl_handle_unref (vbo);
|
cogl_object_unref (vbo);
|
||||||
|
|
||||||
cogl_set_projection_matrix (&old_matrix);
|
cogl_set_projection_matrix (&old_matrix);
|
||||||
cogl_pop_matrix ();
|
cogl_pop_matrix ();
|
||||||
@ -242,7 +242,7 @@ test_cogl_point_sprites_main (int argc, char *argv[])
|
|||||||
|
|
||||||
tex = generate_round_texture ();
|
tex = generate_round_texture ();
|
||||||
cogl_material_set_layer (data.material, 0, tex);
|
cogl_material_set_layer (data.material, 0, tex);
|
||||||
cogl_handle_unref (tex);
|
cogl_object_unref (tex);
|
||||||
|
|
||||||
if (!cogl_material_set_layer_point_sprite_coords_enabled (data.material,
|
if (!cogl_material_set_layer_point_sprite_coords_enabled (data.material,
|
||||||
0, TRUE,
|
0, TRUE,
|
||||||
|
@ -197,7 +197,7 @@ set_shader_num (int new_no)
|
|||||||
|
|
||||||
program = cogl_create_program ();
|
program = cogl_create_program ();
|
||||||
cogl_program_attach_shader (program, shader);
|
cogl_program_attach_shader (program, shader);
|
||||||
cogl_handle_unref (shader);
|
cogl_object_unref (shader);
|
||||||
cogl_program_link (program);
|
cogl_program_link (program);
|
||||||
|
|
||||||
uniform_no = cogl_program_get_uniform_location (program, "tex");
|
uniform_no = cogl_program_get_uniform_location (program, "tex");
|
||||||
@ -215,7 +215,7 @@ set_shader_num (int new_no)
|
|||||||
cogl_program_set_uniform_1f (program, uniform_no, 1.0f / image_height);
|
cogl_program_set_uniform_1f (program, uniform_no, 1.0f / image_height);
|
||||||
|
|
||||||
cogl_material_set_user_program (material, program);
|
cogl_material_set_user_program (material, program);
|
||||||
cogl_handle_unref (program);
|
cogl_object_unref (program);
|
||||||
|
|
||||||
shader_no = new_no;
|
shader_no = new_no;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ test_coglbox_dispose (GObject *object)
|
|||||||
TestCoglboxPrivate *priv;
|
TestCoglboxPrivate *priv;
|
||||||
|
|
||||||
priv = TEST_COGLBOX_GET_PRIVATE (object);
|
priv = TEST_COGLBOX_GET_PRIVATE (object);
|
||||||
cogl_handle_unref (priv->cogl_tex_id);
|
cogl_object_unref (priv->cogl_tex_id);
|
||||||
|
|
||||||
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
|
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ test_coglbox_paint (ClutterActor *self)
|
|||||||
|
|
||||||
cogl_pop_matrix ();
|
cogl_pop_matrix ();
|
||||||
|
|
||||||
cogl_handle_unref (material);
|
cogl_object_unref (material);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -235,8 +235,8 @@ test_coglbox_dispose (GObject *object)
|
|||||||
TestCoglboxPrivate *priv;
|
TestCoglboxPrivate *priv;
|
||||||
|
|
||||||
priv = TEST_COGLBOX_GET_PRIVATE (object);
|
priv = TEST_COGLBOX_GET_PRIVATE (object);
|
||||||
cogl_handle_unref (priv->not_sliced_tex);
|
cogl_object_unref (priv->not_sliced_tex);
|
||||||
cogl_handle_unref (priv->sliced_tex);
|
cogl_object_unref (priv->sliced_tex);
|
||||||
|
|
||||||
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
|
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ test_coglbox_dispose (GObject *object)
|
|||||||
TestCoglboxPrivate *priv;
|
TestCoglboxPrivate *priv;
|
||||||
|
|
||||||
priv = TEST_COGLBOX_GET_PRIVATE (object);
|
priv = TEST_COGLBOX_GET_PRIVATE (object);
|
||||||
cogl_handle_unref (priv->cogl_tex_id);
|
cogl_object_unref (priv->cogl_tex_id);
|
||||||
|
|
||||||
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
|
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -383,8 +383,8 @@ test_cogl_vertex_buffer_main (int argc, char *argv[])
|
|||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
|
|
||||||
cogl_handle_unref (state.buffer);
|
cogl_object_unref (state.buffer);
|
||||||
cogl_handle_unref (state.indices);
|
cogl_object_unref (state.indices);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user