From 4938987d97bef9a74787840e72779f21f7b12d10 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Thu, 19 Sep 2024 22:23:47 +0200 Subject: [PATCH] clutter/paint-nodes: Avoid useless copying of the LayerNode pipeline The constructor already copies the pipeline which means we can add a snippet safely without affecting the parent pipeline, without creating another copy. Fixes: 6b07141f1a ("clutter/paint-nodes: Make paint nodes handle color transformations") Part-of: --- clutter/clutter/clutter-paint-nodes.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c index a607a1a27..95d700f99 100644 --- a/clutter/clutter/clutter-paint-nodes.c +++ b/clutter/clutter/clutter-paint-nodes.c @@ -1204,7 +1204,6 @@ clutter_layer_node_post_draw (ClutterPaintNode *node, { ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node); CoglFramebuffer *fb; - g_autoptr (CoglPipeline) pipeline = NULL; guint i; /* switch to the previous framebuffer */ @@ -1216,9 +1215,8 @@ clutter_layer_node_post_draw (ClutterPaintNode *node, return; fb = clutter_paint_context_get_framebuffer (paint_context); - pipeline = cogl_pipeline_copy (lnode->pipeline); - if (!cogl_pipeline_has_capability (pipeline, + if (!cogl_pipeline_has_capability (lnode->pipeline, CLUTTER_PIPELINE_CAPABILITY, CLUTTER_PIPELINE_CAPABILITY_COLOR_STATE)) { @@ -1231,7 +1229,7 @@ clutter_layer_node_post_draw (ClutterPaintNode *node, clutter_paint_context_get_target_color_state (paint_context); clutter_color_state_add_pipeline_transform (color_state, target_color_state, - pipeline); + lnode->pipeline); } for (i = 0; i < node->operations->len; i++)