mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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;
|
||||
|
||||
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;
|
||||
|
||||
default:
|
||||
@ -568,7 +568,7 @@ clutter_deform_effect_get_property (GObject *gobject,
|
||||
break;
|
||||
|
||||
case PROP_BACK_MATERIAL:
|
||||
g_value_set_boxed (value, priv->back_pipeline);
|
||||
g_value_set_pointer (value, priv->back_pipeline);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -619,9 +619,8 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass)
|
||||
* By default, no material will be used
|
||||
*/
|
||||
obj_props[PROP_BACK_MATERIAL] =
|
||||
g_param_spec_boxed ("back-material", NULL, NULL,
|
||||
COGL_TYPE_HANDLE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_param_spec_pointer ("back-material", NULL, NULL,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
gobject_class->finalize = clutter_deform_effect_finalize;
|
||||
gobject_class->set_property = clutter_deform_effect_set_property;
|
||||
@ -658,10 +657,9 @@ clutter_deform_effect_init (ClutterDeformEffect *self)
|
||||
*/
|
||||
void
|
||||
clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
||||
CoglHandle material)
|
||||
CoglPipeline *pipeline)
|
||||
{
|
||||
ClutterDeformEffectPrivate *priv;
|
||||
CoglPipeline *pipeline = COGL_PIPELINE (material);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
|
||||
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);
|
||||
|
||||
priv->back_pipeline = material;
|
||||
priv->back_pipeline = pipeline;
|
||||
if (priv->back_pipeline != NULL)
|
||||
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
|
||||
* should not be freed directly
|
||||
*/
|
||||
CoglHandle
|
||||
CoglPipeline*
|
||||
clutter_deform_effect_get_back_material (ClutterDeformEffect *effect)
|
||||
{
|
||||
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
|
||||
void clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
|
||||
CoglHandle material);
|
||||
CoglPipeline *material);
|
||||
CLUTTER_EXPORT
|
||||
CoglHandle clutter_deform_effect_get_back_material (ClutterDeformEffect *effect);
|
||||
CoglPipeline* clutter_deform_effect_get_back_material (ClutterDeformEffect *effect);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
|
||||
guint x_tiles,
|
||||
|
@ -84,8 +84,8 @@
|
||||
* typedef struct {
|
||||
* ClutterEffect parent_instance;
|
||||
*
|
||||
* CoglHandle rect_1;
|
||||
* CoglHandle rect_2;
|
||||
* CoglPipeline *rect_1;
|
||||
* CoglPipeline *rect_2;
|
||||
* } MyEffect;
|
||||
*
|
||||
* typedef struct _ClutterEffectClass MyEffectClass;
|
||||
@ -119,12 +119,12 @@
|
||||
* return;
|
||||
*
|
||||
* // Create a red material
|
||||
* self->rect_1 = cogl_material_new ();
|
||||
* cogl_material_set_color4f (self->rect_1, 1.0, 0.0, 0.0, 1.0);
|
||||
* self->rect_1 = cogl_pipeline_new ();
|
||||
* cogl_pipeline_set_color4f (self->rect_1, 1.0, 0.0, 0.0, 1.0);
|
||||
*
|
||||
* // Create a green material
|
||||
* self->rect_2 = cogl_material_new ();
|
||||
* cogl_material_set_color4f (self->rect_2, 0.0, 1.0, 0.0, 1.0);
|
||||
* self->rect_2 = cogl_pipeline_new ();
|
||||
* cogl_pipeline_set_color4f (self->rect_2, 0.0, 1.0, 0.0, 1.0);
|
||||
* }
|
||||
*
|
||||
* static gboolean
|
||||
|
@ -107,7 +107,7 @@ struct _ClutterOffscreenEffectPrivate
|
||||
{
|
||||
CoglOffscreen *offscreen;
|
||||
CoglPipeline *pipeline;
|
||||
CoglHandle texture;
|
||||
CoglTexture *texture;
|
||||
|
||||
ClutterActor *actor;
|
||||
ClutterActor *stage;
|
||||
@ -147,7 +147,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
|
||||
priv->actor = clutter_actor_meta_get_actor (meta);
|
||||
}
|
||||
|
||||
static CoglHandle
|
||||
static CoglTexture*
|
||||
clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height)
|
||||
@ -155,7 +155,7 @@ clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
|
||||
CoglContext *ctx =
|
||||
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
|
||||
@ -624,11 +624,11 @@ clutter_offscreen_effect_init (ClutterOffscreenEffect *self)
|
||||
* used instead of [method@OffscreenEffect.get_texture] when the
|
||||
* 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
|
||||
* modified or freed
|
||||
*/
|
||||
CoglHandle
|
||||
CoglTexture*
|
||||
clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *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
|
||||
* count increased.
|
||||
*/
|
||||
CoglHandle
|
||||
CoglTexture*
|
||||
clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height)
|
||||
|
@ -65,14 +65,14 @@ struct _ClutterOffscreenEffectClass
|
||||
ClutterEffectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
CoglTexture* (* create_texture) (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
CoglPipeline* (* create_pipeline) (ClutterOffscreenEffect *effect,
|
||||
CoglTexture *texture);
|
||||
void (* paint_target) (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* paint_target) (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@ -82,16 +82,16 @@ CLUTTER_EXPORT
|
||||
CoglPipeline * clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
|
||||
CoglTexture* clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
CLUTTER_EXPORT
|
||||
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
CoglTexture* clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
|
||||
|
@ -109,21 +109,6 @@ cogl_object_unref (void *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
|
||||
* an empty entry if available and no entry for the given key can be
|
||||
* found. */
|
||||
|
@ -74,17 +74,6 @@ typedef struct { \
|
||||
(sizeof (TYPE) == (SIZE)) ? 1 : -1]; \
|
||||
} _ ## 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;
|
||||
|
||||
|
@ -161,7 +161,7 @@ static ShaderSource shaders[]=
|
||||
}
|
||||
};
|
||||
|
||||
static CoglHandle redhand;
|
||||
static CoglTexture *redhand;
|
||||
static CoglPipeline *pipeline;
|
||||
static unsigned int timeout_id = 0;
|
||||
static int shader_no = 0;
|
||||
|
@ -59,13 +59,13 @@ assert_region_color (int x,
|
||||
*
|
||||
*
|
||||
*/
|
||||
static CoglHandle
|
||||
static CoglTexture*
|
||||
make_texture (guchar ref)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
guchar *tex_data, *p;
|
||||
CoglHandle tex;
|
||||
CoglTexture *tex;
|
||||
guchar val;
|
||||
|
||||
tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 16);
|
||||
@ -103,7 +103,7 @@ on_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
TestState *state)
|
||||
{
|
||||
CoglHandle tex0, tex1;
|
||||
CoglTexture *tex0, *tex1;
|
||||
CoglPipeline *pipeline;
|
||||
gboolean status;
|
||||
GError *error = NULL;
|
||||
|
@ -25,8 +25,8 @@ on_after_paint (ClutterActor *actor,
|
||||
graphene_matrix_t projection;
|
||||
graphene_matrix_t modelview;
|
||||
guchar *data;
|
||||
CoglHandle tex;
|
||||
CoglHandle offscreen;
|
||||
CoglTexture *tex;
|
||||
CoglOffscreen *offscreen;
|
||||
uint32_t *pixels;
|
||||
uint8_t *pixelsc;
|
||||
|
||||
|
@ -15,11 +15,11 @@ typedef struct _TestState
|
||||
|
||||
/* Creates a texture where the pixels are evenly divided between
|
||||
selecting just one of the R,G and B components */
|
||||
static CoglHandle
|
||||
static CoglTexture*
|
||||
make_texture (void)
|
||||
{
|
||||
guchar *tex_data = g_malloc (TEX_SIZE * TEX_SIZE * 3), *p = tex_data;
|
||||
CoglHandle tex;
|
||||
CoglTexture *tex;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < TEX_SIZE; y++)
|
||||
@ -49,7 +49,7 @@ on_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context,
|
||||
TestState *state)
|
||||
{
|
||||
CoglHandle tex;
|
||||
CoglTexture *tex;
|
||||
CoglPipeline *pipeline;
|
||||
uint8_t pixels[8];
|
||||
|
||||
|
@ -20,7 +20,7 @@ static const ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
|
||||
typedef struct _TestState
|
||||
{
|
||||
ClutterActor *stage;
|
||||
CoglHandle tfp;
|
||||
CoglTexture *tfp;
|
||||
Pixmap pixmap;
|
||||
unsigned int frame_count;
|
||||
Display *display;
|
||||
|
@ -75,8 +75,8 @@ on_after_paint (ClutterActor *actor,
|
||||
graphene_matrix_t projection;
|
||||
graphene_matrix_t modelview;
|
||||
guchar *data;
|
||||
CoglHandle tex;
|
||||
CoglHandle offscreen;
|
||||
CoglTexture *tex;
|
||||
CoglOffscreen *offscreen;
|
||||
CoglColor black;
|
||||
float x0;
|
||||
float y0;
|
||||
|
Loading…
Reference in New Issue
Block a user