From 59a3075f60feb79d826937477d4715f6ec67ecbf Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sun, 5 Jul 2020 13:30:17 -0300 Subject: [PATCH] clutter/offscreen-effect: Remove CoglMaterial from public API Rename clutter_offscreen_effect_get_material() to get_pipeline() and make it return (actuall, stop casting to) a CoglMaterial. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1355 --- clutter/clutter/clutter-deform-effect.c | 6 ++---- clutter/clutter/clutter-offscreen-effect.c | 20 ++++++++++---------- clutter/clutter/clutter-offscreen-effect.h | 2 +- clutter/clutter/clutter-shader-effect.c | 8 ++++---- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/clutter/clutter/clutter-deform-effect.c b/clutter/clutter/clutter-deform-effect.c index a1b7c89bb..d24476172 100644 --- a/clutter/clutter/clutter-deform-effect.c +++ b/clutter/clutter/clutter-deform-effect.c @@ -170,7 +170,6 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect, { ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect); ClutterDeformEffectPrivate *priv = self->priv; - CoglHandle material; CoglPipeline *pipeline; CoglDepthState depth_state; CoglFramebuffer *fb = @@ -277,8 +276,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect, priv->is_dirty = FALSE; } - material = clutter_offscreen_effect_get_target (effect); - pipeline = COGL_PIPELINE (material); + pipeline = clutter_offscreen_effect_get_pipeline (effect); /* enable depth testing */ cogl_depth_state_init (&depth_state); @@ -292,7 +290,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect, COGL_PIPELINE_CULL_FACE_MODE_BACK); /* draw the front */ - if (material != NULL) + if (pipeline != NULL) cogl_framebuffer_draw_primitive (fb, pipeline, priv->primitive); /* draw the back */ diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c index 7a8cc6ab6..0c3e123ea 100644 --- a/clutter/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter/clutter-offscreen-effect.c @@ -575,28 +575,28 @@ clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect) } /** - * clutter_offscreen_effect_get_target: (skip) + * clutter_offscreen_effect_get_pipeline: * @effect: a #ClutterOffscreenEffect * - * Retrieves the material used as a render target for the offscreen + * Retrieves the pipeline used as a render target for the offscreen * buffer created by @effect * - * You should only use the returned #CoglMaterial when painting. The - * returned material might change between different frames. + * You should only use the returned #CoglPipeline when painting. The + * returned pipeline might change between different frames. * - * Return value: (transfer none): a #CoglMaterial or %NULL. The - * returned material is owned by Clutter and it should not be - * modified or freed + * Return value: (transfer none)(nullable): a #CoglPipeline. The + * pipeline is owned by Clutter and it should not be modified + * or freed * * Since: 1.4 */ -CoglMaterial * -clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect) +CoglPipeline * +clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect) { g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect), NULL); - return (CoglMaterial *)effect->priv->pipeline; + return effect->priv->pipeline; } /** diff --git a/clutter/clutter/clutter-offscreen-effect.h b/clutter/clutter/clutter-offscreen-effect.h index 2de98bb0a..6884ea77e 100644 --- a/clutter/clutter/clutter-offscreen-effect.h +++ b/clutter/clutter/clutter-offscreen-effect.h @@ -96,7 +96,7 @@ CLUTTER_EXPORT GType clutter_offscreen_effect_get_type (void) G_GNUC_CONST; CLUTTER_EXPORT -CoglMaterial * clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect); +CoglPipeline * clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect); CLUTTER_EXPORT CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect); diff --git a/clutter/clutter/clutter-shader-effect.c b/clutter/clutter/clutter-shader-effect.c index 59fc1a891..87a866fdf 100644 --- a/clutter/clutter/clutter-shader-effect.c +++ b/clutter/clutter/clutter-shader-effect.c @@ -389,7 +389,7 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect, ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect); ClutterShaderEffectPrivate *priv = self->priv; ClutterOffscreenEffectClass *parent; - CoglHandle material; + CoglPipeline *pipeline; /* If the source hasn't been set then we'll try to get it from the static source instead */ @@ -407,9 +407,9 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect, clutter_shader_effect_update_uniforms (CLUTTER_SHADER_EFFECT (effect)); - /* associate the program to the offscreen target material */ - material = clutter_offscreen_effect_get_target (effect); - cogl_pipeline_set_user_program (material, priv->program); + /* associate the program to the offscreen target pipeline */ + pipeline = clutter_offscreen_effect_get_pipeline (effect); + cogl_pipeline_set_user_program (pipeline, priv->program); out: /* paint the offscreen buffer */