[mutter/gbsneto/effects-cleanups: 8/11] clutter/offscreen-effect: Remove CoglMaterial from public API




commit cef6534e449d6cafd97e2383564f669978ca46a4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Jul 5 13:30:17 2020 -0300

    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

 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 a1b7c89bb5..d244761725 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 a357f51cf6..11160db0e4 100644
--- a/clutter/clutter/clutter-offscreen-effect.c
+++ b/clutter/clutter/clutter-offscreen-effect.c
@@ -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
  *
- * 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 2de98bb0ae..6884ea77e3 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 92526b47ee..f409399ee5 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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]