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
This commit is contained in:
Georges Basile Stavracas Neto 2020-07-05 13:30:17 -03:00
parent 5d7edde37d
commit 59a3075f60
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);
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 */

View File

@ -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;
}
/**

View File

@ -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);

View File

@ -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 */