From 6a612e78cb49151b38f28f71a85102052b7444e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 28 May 2024 16:14:51 +0200 Subject: [PATCH] st: Replace 'material' with 'pipeline' 'Material' is an old name for the same Cogl concept, but lets use the current naming to avoid confusion. Part-of: --- src/st/st-entry.c | 28 ++++++++++---------- src/st/st-theme-node-drawing.c | 44 +++++++++++++++---------------- src/st/st-theme-node-transition.c | 32 +++++++++++----------- src/st/st-theme-node.h | 2 +- 4 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/st/st-entry.c b/src/st/st-entry.c index ccd6e3f9a..ecfc2a007 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -107,7 +107,7 @@ struct _StEntryPrivate StShadow *shadow_spec; - CoglPipeline *text_shadow_material; + CoglPipeline *text_shadow_pipeline; gfloat shadow_width; gfloat shadow_height; }; @@ -216,7 +216,7 @@ st_entry_dispose (GObject *object) StEntry *entry = ST_ENTRY (object); StEntryPrivate *priv = ST_ENTRY_PRIV (entry); - g_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_pipeline); G_OBJECT_CLASS (st_entry_parent_class)->dispose (object); } @@ -254,7 +254,7 @@ st_entry_style_changed (StWidget *self) if (!priv->shadow_spec || !shadow_spec || !st_shadow_equal (shadow_spec, priv->shadow_spec)) { - g_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_pipeline); g_clear_pointer (&priv->shadow_spec, st_shadow_unref); if (shadow_spec) @@ -555,7 +555,7 @@ clutter_text_cursor_changed (ClutterText *text, st_entry_update_hint_visibility (entry); - g_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_pipeline); } static void @@ -569,7 +569,7 @@ clutter_text_changed_cb (GObject *object, st_entry_update_hint_visibility (entry); /* Since the text changed, force a regen of the shadow texture */ - g_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_pipeline); g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_TEXT]); } @@ -581,7 +581,7 @@ invalidate_shadow_pipeline (GObject *object, { StEntryPrivate *priv = ST_ENTRY_PRIV (entry); - g_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_pipeline); } static void @@ -832,27 +832,27 @@ st_entry_paint_node (ClutterActor *actor, clutter_actor_get_allocation_box (priv->entry, &allocation); clutter_actor_box_get_size (&allocation, &width, &height); - if (priv->text_shadow_material == NULL || + if (priv->text_shadow_pipeline == NULL || width != priv->shadow_width || height != priv->shadow_height) { - CoglPipeline *material; + CoglPipeline *pipeline; - g_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_pipeline); - material = _st_create_shadow_pipeline_from_actor (priv->shadow_spec, + pipeline = _st_create_shadow_pipeline_from_actor (priv->shadow_spec, priv->entry); priv->shadow_width = width; priv->shadow_height = height; - priv->text_shadow_material = material; + priv->text_shadow_pipeline = pipeline; } - if (priv->text_shadow_material != NULL) + if (priv->text_shadow_pipeline != NULL) { _st_paint_shadow_with_opacity (priv->shadow_spec, node, - priv->text_shadow_material, + priv->text_shadow_pipeline, &allocation, clutter_actor_get_paint_opacity (priv->entry)); } @@ -1093,7 +1093,7 @@ st_entry_init (StEntry *entry) priv->spacing = 6.0f; - priv->text_shadow_material = NULL; + priv->text_shadow_pipeline = NULL; priv->shadow_width = -1.; priv->shadow_height = -1.; diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c index 58b074eea..2e114caf7 100644 --- a/src/st/st-theme-node-drawing.c +++ b/src/st/st-theme-node-drawing.c @@ -73,7 +73,7 @@ elliptical_arc (cairo_t *cr, } static CoglTexture * -create_corner_material (StCornerSpec *corner) +create_corner_pipeline (StCornerSpec *corner) { ClutterBackend *backend = clutter_get_default_backend (); CoglContext *ctx = clutter_backend_get_cogl_context (backend); @@ -216,7 +216,7 @@ load_corner (StTextureCache *cache, void *datap, GError **error) { - return create_corner_material ((StCornerSpec *) datap); + return create_corner_pipeline ((StCornerSpec *) datap); } /* To match the CSS specification, we want the border to look like it was @@ -368,7 +368,7 @@ st_theme_node_lookup_corner (StThemeNode *node, StCorner corner_id) { CoglTexture *texture = NULL; - CoglPipeline *material = NULL; + CoglPipeline *pipeline = NULL; char *key; StTextureCache *cache; StCornerSpec corner; @@ -426,13 +426,13 @@ st_theme_node_lookup_corner (StThemeNode *node, if (texture) { - material = _st_create_texture_pipeline (texture); + pipeline = _st_create_texture_pipeline (texture); g_object_unref (texture); } g_free (key); - return material; + return pipeline; } static void @@ -1416,13 +1416,13 @@ st_theme_node_maybe_prerender_background (StThemeNodePaintState *state, } } - state->corner_material[ST_CORNER_TOPLEFT] = + state->corner_pipeline[ST_CORNER_TOPLEFT] = st_theme_node_lookup_corner (node, width, height, resource_scale, ST_CORNER_TOPLEFT); - state->corner_material[ST_CORNER_TOPRIGHT] = + state->corner_pipeline[ST_CORNER_TOPRIGHT] = st_theme_node_lookup_corner (node, width, height, resource_scale, ST_CORNER_TOPRIGHT); - state->corner_material[ST_CORNER_BOTTOMRIGHT] = + state->corner_pipeline[ST_CORNER_BOTTOMRIGHT] = st_theme_node_lookup_corner (node, width, height, resource_scale, ST_CORNER_BOTTOMRIGHT); - state->corner_material[ST_CORNER_BOTTOMLEFT] = + state->corner_pipeline[ST_CORNER_BOTTOMLEFT] = st_theme_node_lookup_corner (node, width, height, resource_scale, ST_CORNER_BOTTOMLEFT); /* Use cairo to prerender the node if there is a gradient, or @@ -1670,8 +1670,8 @@ st_theme_node_update_resources (StThemeNodePaintState *state, } static void -paint_material_with_opacity (ClutterPaintNode *node, - CoglPipeline *material, +paint_pipeline_with_opacity (ClutterPaintNode *node, + CoglPipeline *pipeline, ClutterActorBox *box, ClutterActorBox *coords, guint8 paint_opacity) @@ -1682,9 +1682,9 @@ paint_material_with_opacity (ClutterPaintNode *node, cogl_color_init_from_4f (&color, paint_opacity / 255.0, paint_opacity / 255.0, paint_opacity / 255.0, paint_opacity / 255.0); - cogl_pipeline_set_color (material, &color); + cogl_pipeline_set_color (pipeline, &color); - pipeline_node = clutter_pipeline_node_new (material); + pipeline_node = clutter_pipeline_node_new (pipeline); clutter_paint_node_add_child (node, pipeline_node); if (coords) @@ -1825,13 +1825,13 @@ st_theme_node_paint_borders (StThemeNodePaintState *state, { g_autoptr (ClutterPaintNode) corners_node = NULL; - if (state->corner_material[corner_id] == NULL) + if (state->corner_pipeline[corner_id] == NULL) continue; - cogl_pipeline_set_color (state->corner_material[corner_id], &pipeline_color); + cogl_pipeline_set_color (state->corner_pipeline[corner_id], &pipeline_color); corners_node = - clutter_pipeline_node_new (state->corner_material[corner_id]); + clutter_pipeline_node_new (state->corner_pipeline[corner_id]); clutter_paint_node_set_static_name (corners_node, "StThemeNode (CSS border corners)"); clutter_paint_node_add_child (root, corners_node); @@ -2816,7 +2816,7 @@ st_theme_node_paint (StThemeNode *node, &allocation, &paint_box); - paint_material_with_opacity (root, + paint_pipeline_with_opacity (root, state->prerendered_pipeline, &paint_box, NULL, @@ -2880,7 +2880,7 @@ st_theme_node_paint (StThemeNode *node, &background_box, paint_opacity); - paint_material_with_opacity (root, + paint_pipeline_with_opacity (root, node->background_pipeline, &background_box, &texture_coords, @@ -2899,7 +2899,7 @@ st_theme_node_paint_state_node_free_internal (StThemeNodePaintState *state, g_clear_object (&state->box_shadow_pipeline); for (corner_id = 0; corner_id < 4; corner_id++) - g_clear_object (&state->corner_material[corner_id]); + g_clear_object (&state->corner_pipeline[corner_id]); if (unref_node) st_theme_node_paint_state_set_node (state, NULL); @@ -2948,7 +2948,7 @@ st_theme_node_paint_state_init (StThemeNodePaintState *state) state->prerendered_pipeline = NULL; for (corner_id = 0; corner_id < 4; corner_id++) - state->corner_material[corner_id] = NULL; + state->corner_pipeline[corner_id] = NULL; } void @@ -2977,8 +2977,8 @@ st_theme_node_paint_state_copy (StThemeNodePaintState *state, if (other->prerendered_pipeline) state->prerendered_pipeline = g_object_ref (other->prerendered_pipeline); for (corner_id = 0; corner_id < 4; corner_id++) - if (other->corner_material[corner_id]) - state->corner_material[corner_id] = g_object_ref (other->corner_material[corner_id]); + if (other->corner_pipeline[corner_id]) + state->corner_pipeline[corner_id] = g_object_ref (other->corner_pipeline[corner_id]); } void diff --git a/src/st/st-theme-node-transition.c b/src/st/st-theme-node-transition.c index 19e90e822..4d1ca3f8d 100644 --- a/src/st/st-theme-node-transition.c +++ b/src/st/st-theme-node-transition.c @@ -50,7 +50,7 @@ struct _StThemeNodeTransitionPrivate { CoglFramebuffer *old_offscreen; CoglFramebuffer *new_offscreen; - CoglPipeline *material; + CoglPipeline *pipeline; ClutterTimeline *timeline; @@ -256,8 +256,8 @@ setup_framebuffers (StThemeNodeTransition *transition, guint width, height; GError *catch_error = NULL; - /* template material to avoid unnecessary shader compilation */ - static CoglPipeline *material_template = NULL; + /* template pipeline to avoid unnecessary shader compilation */ + static CoglPipeline *pipeline_template = NULL; ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); width = ceilf ((priv->offscreen_box.x2 - priv->offscreen_box.x1) * resource_scale); @@ -296,32 +296,32 @@ setup_framebuffers (StThemeNodeTransition *transition, return FALSE; } - if (priv->material == NULL) + if (priv->pipeline == NULL) { - if (G_UNLIKELY (material_template == NULL)) + if (G_UNLIKELY (pipeline_template == NULL)) { CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); - material_template = cogl_pipeline_new (ctx); + pipeline_template = cogl_pipeline_new (ctx); - cogl_pipeline_set_layer_combine (material_template, 0, + cogl_pipeline_set_layer_combine (pipeline_template, 0, "RGBA = REPLACE (TEXTURE)", NULL); - cogl_pipeline_set_layer_combine (material_template, 1, + cogl_pipeline_set_layer_combine (pipeline_template, 1, "RGBA = INTERPOLATE (PREVIOUS, " "TEXTURE, " "CONSTANT[A])", NULL); - cogl_pipeline_set_layer_combine (material_template, 2, + cogl_pipeline_set_layer_combine (pipeline_template, 2, "RGBA = MODULATE (PREVIOUS, " "PRIMARY)", NULL); } - priv->material = cogl_pipeline_copy (material_template); + priv->pipeline = cogl_pipeline_copy (pipeline_template); } - cogl_pipeline_set_layer_texture (priv->material, 0, priv->new_texture); - cogl_pipeline_set_layer_texture (priv->material, 1, priv->old_texture); + cogl_pipeline_set_layer_texture (priv->pipeline, 0, priv->new_texture); + cogl_pipeline_set_layer_texture (priv->pipeline, 1, priv->old_texture); noop_pipeline = cogl_pipeline_new (ctx); cogl_framebuffer_orthographic (priv->old_offscreen, @@ -392,14 +392,14 @@ st_theme_node_transition_paint (StThemeNodeTransition *transition, cogl_color_init_from_4f (&constant, 0., 0., 0., clutter_timeline_get_progress (priv->timeline)); - cogl_pipeline_set_layer_combine_constant (priv->material, 1, &constant); + cogl_pipeline_set_layer_combine_constant (priv->pipeline, 1, &constant); cogl_color_init_from_4f (&pipeline_color, paint_opacity / 255.0, paint_opacity / 255.0, paint_opacity / 255.0, paint_opacity / 255.0); - cogl_pipeline_set_color (priv->material, &pipeline_color); + cogl_pipeline_set_color (priv->pipeline, &pipeline_color); - pipeline_node = clutter_pipeline_node_new (priv->material); + pipeline_node = clutter_pipeline_node_new (priv->pipeline); clutter_paint_node_add_child (node, pipeline_node); clutter_paint_node_add_multitexture_rectangle (pipeline_node, &priv->offscreen_box, @@ -421,7 +421,7 @@ st_theme_node_transition_dispose (GObject *object) g_clear_object (&priv->old_offscreen); g_clear_object (&priv->new_offscreen); - g_clear_object (&priv->material); + g_clear_object (&priv->pipeline); if (priv->timeline) { diff --git a/src/st/st-theme-node.h b/src/st/st-theme-node.h index 3227a8f11..2ad7b5fd3 100644 --- a/src/st/st-theme-node.h +++ b/src/st/st-theme-node.h @@ -172,7 +172,7 @@ struct _StThemeNodePaintState { CoglPipeline *box_shadow_pipeline; CoglTexture *prerendered_texture; CoglPipeline *prerendered_pipeline; - CoglPipeline *corner_material[4]; + CoglPipeline *corner_pipeline[4]; }; StThemeNode *st_theme_node_new (StThemeContext *context,