[mutter/gbsneto/offscreen-paint-node: 1/4] clutter/offscreen-effect: Implement paint_node()
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/offscreen-paint-node: 1/4] clutter/offscreen-effect: Implement paint_node()
- Date: Tue, 15 Dec 2020 14:48:41 +0000 (UTC)
commit 5b23f41b682c0248553c20e386dc7d6a28643d11
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jul 5 17:57:37 2020 -0300
clutter/offscreen-effect: Implement paint_node()
The paint node tree that ClutterOffscreenEffect generates is
simple:
Root
|------------+
| |
Layer Pipeline
|
Actor
Right now, both pre-paint and ClutterLayerNode push the offscreen
to the framebuffer stack. That's harmless, and will go away soon
anyway.
The actor node is created and added in a separate function because
it'll be reused by the next commit.
clutter/clutter/clutter-offscreen-effect.c | 35 ++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
---
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c
index 84a2d8557f..4871562b76 100644
--- a/clutter/clutter/clutter-offscreen-effect.c
+++ b/clutter/clutter/clutter-offscreen-effect.c
@@ -484,6 +484,40 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect,
clutter_offscreen_effect_paint_texture (self, paint_context);
}
+static void
+add_actor_node (ClutterOffscreenEffect *offscreen_effect,
+ ClutterPaintNode *node,
+ int paint_opacity)
+{
+ ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
+ ClutterPaintNode *actor_node;
+
+ actor_node = clutter_actor_node_new (priv->actor, paint_opacity);
+ clutter_paint_node_add_child (node, actor_node);
+ clutter_paint_node_unref (actor_node);
+}
+
+static void
+clutter_offscreen_effect_paint_node (ClutterEffect *effect,
+ ClutterPaintNode *node,
+ ClutterPaintContext *paint_context,
+ ClutterEffectPaintFlags flags)
+{
+ ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (effect);
+ ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
+ ClutterPaintNode *layer_node;
+ CoglFramebuffer *fb;
+
+ fb = COGL_FRAMEBUFFER (priv->offscreen);
+ layer_node = clutter_layer_node_new_to_framebuffer (fb, priv->pipeline);
+ clutter_paint_node_set_static_name (layer_node,
+ "ClutterOffscreenEffect (actor offscreen)");
+ clutter_paint_node_add_child (node, layer_node);
+ clutter_paint_node_unref (layer_node);
+
+ add_actor_node (offscreen_effect, layer_node, 255);
+}
+
static void
clutter_offscreen_effect_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
@@ -557,6 +591,7 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
effect_class->pre_paint = clutter_offscreen_effect_pre_paint;
effect_class->post_paint = clutter_offscreen_effect_post_paint;
effect_class->paint = clutter_offscreen_effect_paint;
+ effect_class->paint_node = clutter_offscreen_effect_paint_node;
gobject_class->finalize = clutter_offscreen_effect_finalize;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]