cogl/cleanup: Stop using CoglHandle
We use a GParamSpecPointer for CoglPipeline until that gets ported from CoglObject Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
This commit is contained in:
parent
c8b4568973
commit
4792db371a
@ -540,7 +540,7 @@ clutter_deform_effect_set_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BACK_MATERIAL:
|
case PROP_BACK_MATERIAL:
|
||||||
clutter_deform_effect_set_back_material (self, g_value_get_boxed (value));
|
clutter_deform_effect_set_back_material (self, g_value_get_pointer (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -568,7 +568,7 @@ clutter_deform_effect_get_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BACK_MATERIAL:
|
case PROP_BACK_MATERIAL:
|
||||||
g_value_set_boxed (value, priv->back_pipeline);
|
g_value_set_pointer (value, priv->back_pipeline);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -619,9 +619,8 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass)
|
|||||||
* By default, no material will be used
|
* By default, no material will be used
|
||||||
*/
|
*/
|
||||||
obj_props[PROP_BACK_MATERIAL] =
|
obj_props[PROP_BACK_MATERIAL] =
|
||||||
g_param_spec_boxed ("back-material", NULL, NULL,
|
g_param_spec_pointer ("back-material", NULL, NULL,
|
||||||
COGL_TYPE_HANDLE,
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_PARAM_READWRITE);
|
|
||||||
|
|
||||||
gobject_class->finalize = clutter_deform_effect_finalize;
|
gobject_class->finalize = clutter_deform_effect_finalize;
|
||||||
gobject_class->set_property = clutter_deform_effect_set_property;
|
gobject_class->set_property = clutter_deform_effect_set_property;
|
||||||
@ -658,10 +657,9 @@ clutter_deform_effect_init (ClutterDeformEffect *self)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
||||||
CoglHandle material)
|
CoglPipeline *pipeline)
|
||||||
{
|
{
|
||||||
ClutterDeformEffectPrivate *priv;
|
ClutterDeformEffectPrivate *priv;
|
||||||
CoglPipeline *pipeline = COGL_PIPELINE (material);
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
|
g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
|
||||||
g_return_if_fail (pipeline == NULL || cogl_is_pipeline (pipeline));
|
g_return_if_fail (pipeline == NULL || cogl_is_pipeline (pipeline));
|
||||||
@ -670,7 +668,7 @@ clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
|||||||
|
|
||||||
clutter_deform_effect_free_back_pipeline (effect);
|
clutter_deform_effect_free_back_pipeline (effect);
|
||||||
|
|
||||||
priv->back_pipeline = material;
|
priv->back_pipeline = pipeline;
|
||||||
if (priv->back_pipeline != NULL)
|
if (priv->back_pipeline != NULL)
|
||||||
cogl_object_ref (priv->back_pipeline);
|
cogl_object_ref (priv->back_pipeline);
|
||||||
|
|
||||||
@ -687,7 +685,7 @@ clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
|||||||
* The returned material is owned by the #ClutterDeformEffect and it
|
* The returned material is owned by the #ClutterDeformEffect and it
|
||||||
* should not be freed directly
|
* should not be freed directly
|
||||||
*/
|
*/
|
||||||
CoglHandle
|
CoglPipeline*
|
||||||
clutter_deform_effect_get_back_material (ClutterDeformEffect *effect)
|
clutter_deform_effect_get_back_material (ClutterDeformEffect *effect)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect), NULL);
|
g_return_val_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect), NULL);
|
||||||
|
@ -77,9 +77,9 @@ GType clutter_deform_effect_get_type (void) G_GNUC_CONST;
|
|||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
void clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
||||||
CoglHandle material);
|
CoglPipeline *material);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
CoglHandle clutter_deform_effect_get_back_material (ClutterDeformEffect *effect);
|
CoglPipeline* clutter_deform_effect_get_back_material (ClutterDeformEffect *effect);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
|
void clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
|
||||||
guint x_tiles,
|
guint x_tiles,
|
||||||
|
@ -84,8 +84,8 @@
|
|||||||
* typedef struct {
|
* typedef struct {
|
||||||
* ClutterEffect parent_instance;
|
* ClutterEffect parent_instance;
|
||||||
*
|
*
|
||||||
* CoglHandle rect_1;
|
* CoglPipeline *rect_1;
|
||||||
* CoglHandle rect_2;
|
* CoglPipeline *rect_2;
|
||||||
* } MyEffect;
|
* } MyEffect;
|
||||||
*
|
*
|
||||||
* typedef struct _ClutterEffectClass MyEffectClass;
|
* typedef struct _ClutterEffectClass MyEffectClass;
|
||||||
@ -119,12 +119,12 @@
|
|||||||
* return;
|
* return;
|
||||||
*
|
*
|
||||||
* // Create a red material
|
* // Create a red material
|
||||||
* self->rect_1 = cogl_material_new ();
|
* self->rect_1 = cogl_pipeline_new ();
|
||||||
* cogl_material_set_color4f (self->rect_1, 1.0, 0.0, 0.0, 1.0);
|
* cogl_pipeline_set_color4f (self->rect_1, 1.0, 0.0, 0.0, 1.0);
|
||||||
*
|
*
|
||||||
* // Create a green material
|
* // Create a green material
|
||||||
* self->rect_2 = cogl_material_new ();
|
* self->rect_2 = cogl_pipeline_new ();
|
||||||
* cogl_material_set_color4f (self->rect_2, 0.0, 1.0, 0.0, 1.0);
|
* cogl_pipeline_set_color4f (self->rect_2, 0.0, 1.0, 0.0, 1.0);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* static gboolean
|
* static gboolean
|
||||||
|
@ -107,7 +107,7 @@ struct _ClutterOffscreenEffectPrivate
|
|||||||
{
|
{
|
||||||
CoglOffscreen *offscreen;
|
CoglOffscreen *offscreen;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglHandle texture;
|
CoglTexture *texture;
|
||||||
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
@ -147,7 +147,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
|
|||||||
priv->actor = clutter_actor_meta_get_actor (meta);
|
priv->actor = clutter_actor_meta_get_actor (meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglHandle
|
static CoglTexture*
|
||||||
clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
|
clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
|
||||||
gfloat width,
|
gfloat width,
|
||||||
gfloat height)
|
gfloat height)
|
||||||
@ -155,7 +155,7 @@ clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
|
|||||||
CoglContext *ctx =
|
CoglContext *ctx =
|
||||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
|
|
||||||
return cogl_texture_2d_new_with_size (ctx, MAX (width, 1), MAX (height, 1));
|
return COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, MAX (width, 1), MAX (height, 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -624,11 +624,11 @@ clutter_offscreen_effect_init (ClutterOffscreenEffect *self)
|
|||||||
* used instead of [method@OffscreenEffect.get_texture] when the
|
* used instead of [method@OffscreenEffect.get_texture] when the
|
||||||
* effect subclass wants to paint using its own material.
|
* effect subclass wants to paint using its own material.
|
||||||
*
|
*
|
||||||
* Return value: (transfer none): a #CoglHandle or %NULL. The
|
* Return value: (transfer none): a #CoglTexture or %NULL. The
|
||||||
* returned texture is owned by Clutter and it should not be
|
* returned texture is owned by Clutter and it should not be
|
||||||
* modified or freed
|
* modified or freed
|
||||||
*/
|
*/
|
||||||
CoglHandle
|
CoglTexture*
|
||||||
clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect)
|
clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
|
g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
|
||||||
@ -692,7 +692,7 @@ clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
|||||||
* %NULL. The returned handle has its reference
|
* %NULL. The returned handle has its reference
|
||||||
* count increased.
|
* count increased.
|
||||||
*/
|
*/
|
||||||
CoglHandle
|
CoglTexture*
|
||||||
clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
||||||
gfloat width,
|
gfloat width,
|
||||||
gfloat height)
|
gfloat height)
|
||||||
|
@ -65,14 +65,14 @@ struct _ClutterOffscreenEffectClass
|
|||||||
ClutterEffectClass parent_class;
|
ClutterEffectClass parent_class;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
|
CoglTexture* (* create_texture) (ClutterOffscreenEffect *effect,
|
||||||
gfloat width,
|
gfloat width,
|
||||||
gfloat height);
|
gfloat height);
|
||||||
CoglPipeline* (* create_pipeline) (ClutterOffscreenEffect *effect,
|
CoglPipeline* (* create_pipeline) (ClutterOffscreenEffect *effect,
|
||||||
CoglTexture *texture);
|
CoglTexture *texture);
|
||||||
void (* paint_target) (ClutterOffscreenEffect *effect,
|
void (* paint_target) (ClutterOffscreenEffect *effect,
|
||||||
ClutterPaintNode *node,
|
ClutterPaintNode *node,
|
||||||
ClutterPaintContext *paint_context);
|
ClutterPaintContext *paint_context);
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
@ -82,16 +82,16 @@ CLUTTER_EXPORT
|
|||||||
CoglPipeline * clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect);
|
CoglPipeline * clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
|
CoglTexture* clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||||
ClutterPaintNode *node,
|
ClutterPaintNode *node,
|
||||||
ClutterPaintContext *paint_context);
|
ClutterPaintContext *paint_context);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
CoglTexture* clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
||||||
gfloat width,
|
gfloat width,
|
||||||
gfloat height);
|
gfloat height);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
|
gboolean clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
|
||||||
|
@ -109,21 +109,6 @@ cogl_object_unref (void *obj)
|
|||||||
unref_func (obj);
|
unref_func (obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
|
||||||
cogl_handle_get_type (void)
|
|
||||||
{
|
|
||||||
static GType our_type = 0;
|
|
||||||
|
|
||||||
/* XXX: We are keeping the "CoglHandle" name for now in case it would
|
|
||||||
* break bindings to change to "CoglObject" */
|
|
||||||
if (G_UNLIKELY (our_type == 0))
|
|
||||||
our_type = g_boxed_type_register_static (g_intern_static_string ("CoglHandle"),
|
|
||||||
(GBoxedCopyFunc) cogl_object_ref,
|
|
||||||
(GBoxedFreeFunc) cogl_object_unref);
|
|
||||||
|
|
||||||
return our_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX: Unlike for cogl_object_get_user_data this code will return
|
/* XXX: Unlike for cogl_object_get_user_data this code will return
|
||||||
* an empty entry if available and no entry for the given key can be
|
* an empty entry if available and no entry for the given key can be
|
||||||
* found. */
|
* found. */
|
||||||
|
@ -74,17 +74,6 @@ typedef struct { \
|
|||||||
(sizeof (TYPE) == (SIZE)) ? 1 : -1]; \
|
(sizeof (TYPE) == (SIZE)) ? 1 : -1]; \
|
||||||
} _ ## TYPE ## SizeCheck
|
} _ ## TYPE ## SizeCheck
|
||||||
|
|
||||||
/**
|
|
||||||
* CoglHandle:
|
|
||||||
*
|
|
||||||
* Type used for storing references to cogl objects, the CoglHandle is
|
|
||||||
* a fully opaque type without any public data members.
|
|
||||||
*/
|
|
||||||
typedef void * CoglHandle;
|
|
||||||
|
|
||||||
#define COGL_TYPE_HANDLE (cogl_handle_get_type ())
|
|
||||||
COGL_EXPORT GType
|
|
||||||
cogl_handle_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
typedef struct _CoglFramebuffer CoglFramebuffer;
|
typedef struct _CoglFramebuffer CoglFramebuffer;
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ static ShaderSource shaders[]=
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static CoglHandle redhand;
|
static CoglTexture *redhand;
|
||||||
static CoglPipeline *pipeline;
|
static CoglPipeline *pipeline;
|
||||||
static unsigned int timeout_id = 0;
|
static unsigned int timeout_id = 0;
|
||||||
static int shader_no = 0;
|
static int shader_no = 0;
|
||||||
|
@ -59,13 +59,13 @@ assert_region_color (int x,
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static CoglHandle
|
static CoglTexture*
|
||||||
make_texture (guchar ref)
|
make_texture (guchar ref)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
guchar *tex_data, *p;
|
guchar *tex_data, *p;
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
guchar val;
|
guchar val;
|
||||||
|
|
||||||
tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 16);
|
tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 16);
|
||||||
@ -103,7 +103,7 @@ on_paint (ClutterActor *actor,
|
|||||||
ClutterPaintContext *paint_context,
|
ClutterPaintContext *paint_context,
|
||||||
TestState *state)
|
TestState *state)
|
||||||
{
|
{
|
||||||
CoglHandle tex0, tex1;
|
CoglTexture *tex0, *tex1;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
gboolean status;
|
gboolean status;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
@ -25,8 +25,8 @@ on_after_paint (ClutterActor *actor,
|
|||||||
graphene_matrix_t projection;
|
graphene_matrix_t projection;
|
||||||
graphene_matrix_t modelview;
|
graphene_matrix_t modelview;
|
||||||
guchar *data;
|
guchar *data;
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
CoglHandle offscreen;
|
CoglOffscreen *offscreen;
|
||||||
uint32_t *pixels;
|
uint32_t *pixels;
|
||||||
uint8_t *pixelsc;
|
uint8_t *pixelsc;
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ typedef struct _TestState
|
|||||||
|
|
||||||
/* Creates a texture where the pixels are evenly divided between
|
/* Creates a texture where the pixels are evenly divided between
|
||||||
selecting just one of the R,G and B components */
|
selecting just one of the R,G and B components */
|
||||||
static CoglHandle
|
static CoglTexture*
|
||||||
make_texture (void)
|
make_texture (void)
|
||||||
{
|
{
|
||||||
guchar *tex_data = g_malloc (TEX_SIZE * TEX_SIZE * 3), *p = tex_data;
|
guchar *tex_data = g_malloc (TEX_SIZE * TEX_SIZE * 3), *p = tex_data;
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
for (y = 0; y < TEX_SIZE; y++)
|
for (y = 0; y < TEX_SIZE; y++)
|
||||||
@ -49,7 +49,7 @@ on_paint (ClutterActor *actor,
|
|||||||
ClutterPaintContext *paint_context,
|
ClutterPaintContext *paint_context,
|
||||||
TestState *state)
|
TestState *state)
|
||||||
{
|
{
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
uint8_t pixels[8];
|
uint8_t pixels[8];
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ static const ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
|
|||||||
typedef struct _TestState
|
typedef struct _TestState
|
||||||
{
|
{
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
CoglHandle tfp;
|
CoglTexture *tfp;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
unsigned int frame_count;
|
unsigned int frame_count;
|
||||||
Display *display;
|
Display *display;
|
||||||
|
@ -75,8 +75,8 @@ on_after_paint (ClutterActor *actor,
|
|||||||
graphene_matrix_t projection;
|
graphene_matrix_t projection;
|
||||||
graphene_matrix_t modelview;
|
graphene_matrix_t modelview;
|
||||||
guchar *data;
|
guchar *data;
|
||||||
CoglHandle tex;
|
CoglTexture *tex;
|
||||||
CoglHandle offscreen;
|
CoglOffscreen *offscreen;
|
||||||
CoglColor black;
|
CoglColor black;
|
||||||
float x0;
|
float x0;
|
||||||
float y0;
|
float y0;
|
||||||
|
Loading…
Reference in New Issue
Block a user