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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3363>
This commit is contained in:
parent
751fedb95c
commit
6a612e78cb
@ -107,7 +107,7 @@ struct _StEntryPrivate
|
|||||||
|
|
||||||
StShadow *shadow_spec;
|
StShadow *shadow_spec;
|
||||||
|
|
||||||
CoglPipeline *text_shadow_material;
|
CoglPipeline *text_shadow_pipeline;
|
||||||
gfloat shadow_width;
|
gfloat shadow_width;
|
||||||
gfloat shadow_height;
|
gfloat shadow_height;
|
||||||
};
|
};
|
||||||
@ -216,7 +216,7 @@ st_entry_dispose (GObject *object)
|
|||||||
StEntry *entry = ST_ENTRY (object);
|
StEntry *entry = ST_ENTRY (object);
|
||||||
StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
|
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);
|
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 ||
|
if (!priv->shadow_spec || !shadow_spec ||
|
||||||
!st_shadow_equal (shadow_spec, priv->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);
|
g_clear_pointer (&priv->shadow_spec, st_shadow_unref);
|
||||||
if (shadow_spec)
|
if (shadow_spec)
|
||||||
@ -555,7 +555,7 @@ clutter_text_cursor_changed (ClutterText *text,
|
|||||||
|
|
||||||
st_entry_update_hint_visibility (entry);
|
st_entry_update_hint_visibility (entry);
|
||||||
|
|
||||||
g_clear_object (&priv->text_shadow_material);
|
g_clear_object (&priv->text_shadow_pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -569,7 +569,7 @@ clutter_text_changed_cb (GObject *object,
|
|||||||
st_entry_update_hint_visibility (entry);
|
st_entry_update_hint_visibility (entry);
|
||||||
|
|
||||||
/* Since the text changed, force a regen of the shadow texture */
|
/* 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]);
|
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);
|
StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
|
||||||
|
|
||||||
g_clear_object (&priv->text_shadow_material);
|
g_clear_object (&priv->text_shadow_pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -832,27 +832,27 @@ st_entry_paint_node (ClutterActor *actor,
|
|||||||
clutter_actor_get_allocation_box (priv->entry, &allocation);
|
clutter_actor_get_allocation_box (priv->entry, &allocation);
|
||||||
clutter_actor_box_get_size (&allocation, &width, &height);
|
clutter_actor_box_get_size (&allocation, &width, &height);
|
||||||
|
|
||||||
if (priv->text_shadow_material == NULL ||
|
if (priv->text_shadow_pipeline == NULL ||
|
||||||
width != priv->shadow_width ||
|
width != priv->shadow_width ||
|
||||||
height != priv->shadow_height)
|
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->entry);
|
||||||
|
|
||||||
priv->shadow_width = width;
|
priv->shadow_width = width;
|
||||||
priv->shadow_height = height;
|
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,
|
_st_paint_shadow_with_opacity (priv->shadow_spec,
|
||||||
node,
|
node,
|
||||||
priv->text_shadow_material,
|
priv->text_shadow_pipeline,
|
||||||
&allocation,
|
&allocation,
|
||||||
clutter_actor_get_paint_opacity (priv->entry));
|
clutter_actor_get_paint_opacity (priv->entry));
|
||||||
}
|
}
|
||||||
@ -1093,7 +1093,7 @@ st_entry_init (StEntry *entry)
|
|||||||
|
|
||||||
priv->spacing = 6.0f;
|
priv->spacing = 6.0f;
|
||||||
|
|
||||||
priv->text_shadow_material = NULL;
|
priv->text_shadow_pipeline = NULL;
|
||||||
priv->shadow_width = -1.;
|
priv->shadow_width = -1.;
|
||||||
priv->shadow_height = -1.;
|
priv->shadow_height = -1.;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ elliptical_arc (cairo_t *cr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglTexture *
|
static CoglTexture *
|
||||||
create_corner_material (StCornerSpec *corner)
|
create_corner_pipeline (StCornerSpec *corner)
|
||||||
{
|
{
|
||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
||||||
@ -216,7 +216,7 @@ load_corner (StTextureCache *cache,
|
|||||||
void *datap,
|
void *datap,
|
||||||
GError **error)
|
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
|
/* 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)
|
StCorner corner_id)
|
||||||
{
|
{
|
||||||
CoglTexture *texture = NULL;
|
CoglTexture *texture = NULL;
|
||||||
CoglPipeline *material = NULL;
|
CoglPipeline *pipeline = NULL;
|
||||||
char *key;
|
char *key;
|
||||||
StTextureCache *cache;
|
StTextureCache *cache;
|
||||||
StCornerSpec corner;
|
StCornerSpec corner;
|
||||||
@ -426,13 +426,13 @@ st_theme_node_lookup_corner (StThemeNode *node,
|
|||||||
|
|
||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
material = _st_create_texture_pipeline (texture);
|
pipeline = _st_create_texture_pipeline (texture);
|
||||||
g_object_unref (texture);
|
g_object_unref (texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (key);
|
g_free (key);
|
||||||
|
|
||||||
return material;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
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);
|
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);
|
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);
|
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
|
/* 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
|
static void
|
||||||
paint_material_with_opacity (ClutterPaintNode *node,
|
paint_pipeline_with_opacity (ClutterPaintNode *node,
|
||||||
CoglPipeline *material,
|
CoglPipeline *pipeline,
|
||||||
ClutterActorBox *box,
|
ClutterActorBox *box,
|
||||||
ClutterActorBox *coords,
|
ClutterActorBox *coords,
|
||||||
guint8 paint_opacity)
|
guint8 paint_opacity)
|
||||||
@ -1682,9 +1682,9 @@ paint_material_with_opacity (ClutterPaintNode *node,
|
|||||||
cogl_color_init_from_4f (&color,
|
cogl_color_init_from_4f (&color,
|
||||||
paint_opacity / 255.0, paint_opacity / 255.0,
|
paint_opacity / 255.0, paint_opacity / 255.0,
|
||||||
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);
|
clutter_paint_node_add_child (node, pipeline_node);
|
||||||
|
|
||||||
if (coords)
|
if (coords)
|
||||||
@ -1825,13 +1825,13 @@ st_theme_node_paint_borders (StThemeNodePaintState *state,
|
|||||||
{
|
{
|
||||||
g_autoptr (ClutterPaintNode) corners_node = NULL;
|
g_autoptr (ClutterPaintNode) corners_node = NULL;
|
||||||
|
|
||||||
if (state->corner_material[corner_id] == NULL)
|
if (state->corner_pipeline[corner_id] == NULL)
|
||||||
continue;
|
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 =
|
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,
|
clutter_paint_node_set_static_name (corners_node,
|
||||||
"StThemeNode (CSS border corners)");
|
"StThemeNode (CSS border corners)");
|
||||||
clutter_paint_node_add_child (root, corners_node);
|
clutter_paint_node_add_child (root, corners_node);
|
||||||
@ -2816,7 +2816,7 @@ st_theme_node_paint (StThemeNode *node,
|
|||||||
&allocation,
|
&allocation,
|
||||||
&paint_box);
|
&paint_box);
|
||||||
|
|
||||||
paint_material_with_opacity (root,
|
paint_pipeline_with_opacity (root,
|
||||||
state->prerendered_pipeline,
|
state->prerendered_pipeline,
|
||||||
&paint_box,
|
&paint_box,
|
||||||
NULL,
|
NULL,
|
||||||
@ -2880,7 +2880,7 @@ st_theme_node_paint (StThemeNode *node,
|
|||||||
&background_box,
|
&background_box,
|
||||||
paint_opacity);
|
paint_opacity);
|
||||||
|
|
||||||
paint_material_with_opacity (root,
|
paint_pipeline_with_opacity (root,
|
||||||
node->background_pipeline,
|
node->background_pipeline,
|
||||||
&background_box,
|
&background_box,
|
||||||
&texture_coords,
|
&texture_coords,
|
||||||
@ -2899,7 +2899,7 @@ st_theme_node_paint_state_node_free_internal (StThemeNodePaintState *state,
|
|||||||
g_clear_object (&state->box_shadow_pipeline);
|
g_clear_object (&state->box_shadow_pipeline);
|
||||||
|
|
||||||
for (corner_id = 0; corner_id < 4; corner_id++)
|
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)
|
if (unref_node)
|
||||||
st_theme_node_paint_state_set_node (state, NULL);
|
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;
|
state->prerendered_pipeline = NULL;
|
||||||
|
|
||||||
for (corner_id = 0; corner_id < 4; corner_id++)
|
for (corner_id = 0; corner_id < 4; corner_id++)
|
||||||
state->corner_material[corner_id] = NULL;
|
state->corner_pipeline[corner_id] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2977,8 +2977,8 @@ st_theme_node_paint_state_copy (StThemeNodePaintState *state,
|
|||||||
if (other->prerendered_pipeline)
|
if (other->prerendered_pipeline)
|
||||||
state->prerendered_pipeline = g_object_ref (other->prerendered_pipeline);
|
state->prerendered_pipeline = g_object_ref (other->prerendered_pipeline);
|
||||||
for (corner_id = 0; corner_id < 4; corner_id++)
|
for (corner_id = 0; corner_id < 4; corner_id++)
|
||||||
if (other->corner_material[corner_id])
|
if (other->corner_pipeline[corner_id])
|
||||||
state->corner_material[corner_id] = g_object_ref (other->corner_material[corner_id]);
|
state->corner_pipeline[corner_id] = g_object_ref (other->corner_pipeline[corner_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -50,7 +50,7 @@ struct _StThemeNodeTransitionPrivate {
|
|||||||
CoglFramebuffer *old_offscreen;
|
CoglFramebuffer *old_offscreen;
|
||||||
CoglFramebuffer *new_offscreen;
|
CoglFramebuffer *new_offscreen;
|
||||||
|
|
||||||
CoglPipeline *material;
|
CoglPipeline *pipeline;
|
||||||
|
|
||||||
ClutterTimeline *timeline;
|
ClutterTimeline *timeline;
|
||||||
|
|
||||||
@ -256,8 +256,8 @@ setup_framebuffers (StThemeNodeTransition *transition,
|
|||||||
guint width, height;
|
guint width, height;
|
||||||
GError *catch_error = NULL;
|
GError *catch_error = NULL;
|
||||||
|
|
||||||
/* template material to avoid unnecessary shader compilation */
|
/* template pipeline to avoid unnecessary shader compilation */
|
||||||
static CoglPipeline *material_template = NULL;
|
static CoglPipeline *pipeline_template = NULL;
|
||||||
|
|
||||||
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
width = ceilf ((priv->offscreen_box.x2 - priv->offscreen_box.x1) * resource_scale);
|
width = ceilf ((priv->offscreen_box.x2 - priv->offscreen_box.x1) * resource_scale);
|
||||||
@ -296,32 +296,32 @@ setup_framebuffers (StThemeNodeTransition *transition,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->material == NULL)
|
if (priv->pipeline == NULL)
|
||||||
{
|
{
|
||||||
if (G_UNLIKELY (material_template == NULL))
|
if (G_UNLIKELY (pipeline_template == NULL))
|
||||||
{
|
{
|
||||||
CoglContext *ctx =
|
CoglContext *ctx =
|
||||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
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)",
|
"RGBA = REPLACE (TEXTURE)",
|
||||||
NULL);
|
NULL);
|
||||||
cogl_pipeline_set_layer_combine (material_template, 1,
|
cogl_pipeline_set_layer_combine (pipeline_template, 1,
|
||||||
"RGBA = INTERPOLATE (PREVIOUS, "
|
"RGBA = INTERPOLATE (PREVIOUS, "
|
||||||
"TEXTURE, "
|
"TEXTURE, "
|
||||||
"CONSTANT[A])",
|
"CONSTANT[A])",
|
||||||
NULL);
|
NULL);
|
||||||
cogl_pipeline_set_layer_combine (material_template, 2,
|
cogl_pipeline_set_layer_combine (pipeline_template, 2,
|
||||||
"RGBA = MODULATE (PREVIOUS, "
|
"RGBA = MODULATE (PREVIOUS, "
|
||||||
"PRIMARY)",
|
"PRIMARY)",
|
||||||
NULL);
|
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->pipeline, 0, priv->new_texture);
|
||||||
cogl_pipeline_set_layer_texture (priv->material, 1, priv->old_texture);
|
cogl_pipeline_set_layer_texture (priv->pipeline, 1, priv->old_texture);
|
||||||
|
|
||||||
noop_pipeline = cogl_pipeline_new (ctx);
|
noop_pipeline = cogl_pipeline_new (ctx);
|
||||||
cogl_framebuffer_orthographic (priv->old_offscreen,
|
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.,
|
cogl_color_init_from_4f (&constant, 0., 0., 0.,
|
||||||
clutter_timeline_get_progress (priv->timeline));
|
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,
|
cogl_color_init_from_4f (&pipeline_color,
|
||||||
paint_opacity / 255.0, paint_opacity / 255.0,
|
paint_opacity / 255.0, paint_opacity / 255.0,
|
||||||
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_child (node, pipeline_node);
|
||||||
clutter_paint_node_add_multitexture_rectangle (pipeline_node,
|
clutter_paint_node_add_multitexture_rectangle (pipeline_node,
|
||||||
&priv->offscreen_box,
|
&priv->offscreen_box,
|
||||||
@ -421,7 +421,7 @@ st_theme_node_transition_dispose (GObject *object)
|
|||||||
g_clear_object (&priv->old_offscreen);
|
g_clear_object (&priv->old_offscreen);
|
||||||
g_clear_object (&priv->new_offscreen);
|
g_clear_object (&priv->new_offscreen);
|
||||||
|
|
||||||
g_clear_object (&priv->material);
|
g_clear_object (&priv->pipeline);
|
||||||
|
|
||||||
if (priv->timeline)
|
if (priv->timeline)
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,7 @@ struct _StThemeNodePaintState {
|
|||||||
CoglPipeline *box_shadow_pipeline;
|
CoglPipeline *box_shadow_pipeline;
|
||||||
CoglTexture *prerendered_texture;
|
CoglTexture *prerendered_texture;
|
||||||
CoglPipeline *prerendered_pipeline;
|
CoglPipeline *prerendered_pipeline;
|
||||||
CoglPipeline *corner_material[4];
|
CoglPipeline *corner_pipeline[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
StThemeNode *st_theme_node_new (StThemeContext *context,
|
StThemeNode *st_theme_node_new (StThemeContext *context,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user