clutter/offscreen-effect: Remove CoglMaterial from public API

Rename clutter_offscreen_effect_get_material() to get_pipeline() and
make it return (actually, stop casting to) a CoglMaterial.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1474
This commit is contained in:
Georges Basile Stavracas Neto 2020-07-05 13:30:17 -03:00
parent f6500042f1
commit cef6534e44
4 changed files with 17 additions and 19 deletions

View File

@ -170,7 +170,6 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
{ {
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect); ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
ClutterDeformEffectPrivate *priv = self->priv; ClutterDeformEffectPrivate *priv = self->priv;
CoglHandle material;
CoglPipeline *pipeline; CoglPipeline *pipeline;
CoglDepthState depth_state; CoglDepthState depth_state;
CoglFramebuffer *fb = CoglFramebuffer *fb =
@ -277,8 +276,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
priv->is_dirty = FALSE; priv->is_dirty = FALSE;
} }
material = clutter_offscreen_effect_get_target (effect); pipeline = clutter_offscreen_effect_get_pipeline (effect);
pipeline = COGL_PIPELINE (material);
/* enable depth testing */ /* enable depth testing */
cogl_depth_state_init (&depth_state); cogl_depth_state_init (&depth_state);
@ -292,7 +290,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
COGL_PIPELINE_CULL_FACE_MODE_BACK); COGL_PIPELINE_CULL_FACE_MODE_BACK);
/* draw the front */ /* draw the front */
if (material != NULL) if (pipeline != NULL)
cogl_framebuffer_draw_primitive (fb, pipeline, priv->primitive); cogl_framebuffer_draw_primitive (fb, pipeline, priv->primitive);
/* draw the back */ /* draw the back */

View File

@ -597,28 +597,28 @@ clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect)
} }
/** /**
* clutter_offscreen_effect_get_target: (skip) * clutter_offscreen_effect_get_pipeline:
* @effect: a #ClutterOffscreenEffect * @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 * buffer created by @effect
* *
* You should only use the returned #CoglMaterial when painting. The * You should only use the returned #CoglPipeline when painting. The
* returned material might change between different frames. * returned pipeline might change between different frames.
* *
* Return value: (transfer none): a #CoglMaterial or %NULL. The * Return value: (transfer none)(nullable): a #CoglPipeline. The
* returned material is owned by Clutter and it should not be * pipeline is owned by Clutter and it should not be modified
* modified or freed * or freed
* *
* Since: 1.4 * Since: 1.4
*/ */
CoglMaterial * CoglPipeline *
clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect) clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect)
{ {
g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect), g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
NULL); NULL);
return (CoglMaterial *)effect->priv->pipeline; return effect->priv->pipeline;
} }
/** /**

View File

@ -96,7 +96,7 @@ CLUTTER_EXPORT
GType clutter_offscreen_effect_get_type (void) G_GNUC_CONST; GType clutter_offscreen_effect_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT CLUTTER_EXPORT
CoglMaterial * clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect); CoglPipeline * clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect);
CLUTTER_EXPORT CLUTTER_EXPORT
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect); CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);

View File

@ -389,7 +389,7 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect); ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect);
ClutterShaderEffectPrivate *priv = self->priv; ClutterShaderEffectPrivate *priv = self->priv;
ClutterOffscreenEffectClass *parent; ClutterOffscreenEffectClass *parent;
CoglHandle material; CoglPipeline *pipeline;
/* If the source hasn't been set then we'll try to get it from the /* If the source hasn't been set then we'll try to get it from the
static source instead */ static source instead */
@ -407,9 +407,9 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
clutter_shader_effect_update_uniforms (CLUTTER_SHADER_EFFECT (effect)); clutter_shader_effect_update_uniforms (CLUTTER_SHADER_EFFECT (effect));
/* associate the program to the offscreen target material */ /* associate the program to the offscreen target pipeline */
material = clutter_offscreen_effect_get_target (effect); pipeline = clutter_offscreen_effect_get_pipeline (effect);
cogl_pipeline_set_user_program (material, priv->program); cogl_pipeline_set_user_program (pipeline, priv->program);
out: out:
/* paint the offscreen buffer */ /* paint the offscreen buffer */