st/theme-node-transition: Add snapshot variant

Add st_theme_node_transition_snapshot(), which is unused for the
moment, and is just a dumb wrapper around the existing code. It
will be used in the future for StThemeNode snapshotting.
This commit is contained in:
Georges Basile Stavracas Neto 2024-06-14 18:23:41 -03:00
parent 6ba166660f
commit 6b0300c222
2 changed files with 57 additions and 0 deletions

View file

@ -395,6 +395,57 @@ st_theme_node_transition_paint (StThemeNodeTransition *transition,
tex_coords, 8);
}
void
st_theme_node_transition_snapshot (StThemeNodeTransition *transition,
ClutterSnapshot *snapshot,
ClutterActorBox *allocation,
guint8 paint_opacity,
float resource_scale)
{
StThemeNodeTransitionPrivate *priv = transition->priv;
CoglColor constant, pipeline_color;
float tex_coords[] = {
0.0, 0.0, 1.0, 1.0,
0.0, 0.0, 1.0, 1.0,
};
g_return_if_fail (ST_IS_THEME_NODE (priv->old_theme_node));
g_return_if_fail (ST_IS_THEME_NODE (priv->new_theme_node));
if (!clutter_actor_box_equal (allocation, &priv->last_allocation))
priv->needs_setup = TRUE;
if (priv->needs_setup)
{
priv->last_allocation = *allocation;
calculate_offscreen_box (transition, allocation);
priv->needs_setup = clutter_actor_box_get_area (&priv->offscreen_box) == 0 ||
!setup_framebuffers (transition, allocation,
resource_scale);
if (priv->needs_setup) /* setting up framebuffers failed */
return;
}
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_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);
clutter_snapshot_push_pipeline (snapshot, priv->material);
clutter_snapshot_add_multitexture_rectangle (snapshot,
&priv->offscreen_box,
tex_coords, 8);
clutter_snapshot_pop (snapshot);
}
static void
st_theme_node_transition_dispose (GObject *object)
{

View file

@ -47,6 +47,12 @@ void st_theme_node_transition_paint (StThemeNodeTransition *transition,
guint8 paint_opacity,
float resource_scale);
void st_theme_node_transition_snapshot (StThemeNodeTransition *transition,
ClutterSnapshot *snapshot,
ClutterActorBox *allocation,
guint8 paint_opacity,
float resource_scale);
void st_theme_node_transition_get_paint_box (StThemeNodeTransition *transition,
const ClutterActorBox *allocation,
ClutterActorBox *paint_box);