mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
gtk: Add gtk_snapshot_push_subsurface
This is currently private api.
This commit is contained in:
parent
904d44074f
commit
ba5403da17
@ -134,6 +134,9 @@ struct _GtkSnapshotState {
|
||||
GskMaskMode mask_mode;
|
||||
GskRenderNode *mask_node;
|
||||
} mask;
|
||||
struct {
|
||||
GdkSubsurface *subsurface;
|
||||
} subsurface;
|
||||
} data;
|
||||
};
|
||||
|
||||
@ -2830,3 +2833,42 @@ gtk_snapshot_append_outset_shadow (GtkSnapshot *snapshot,
|
||||
|
||||
gtk_snapshot_append_node_internal (snapshot, node);
|
||||
}
|
||||
|
||||
static GskRenderNode *
|
||||
gtk_snapshot_collect_subsurface (GtkSnapshot *snapshot,
|
||||
GtkSnapshotState *state,
|
||||
GskRenderNode **nodes,
|
||||
guint n_nodes)
|
||||
{
|
||||
GskRenderNode *node, *subsurface_node;
|
||||
|
||||
node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes);
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
subsurface_node = gsk_subsurface_node_new (node, state->data.subsurface.subsurface);
|
||||
gsk_render_node_unref (node);
|
||||
|
||||
return subsurface_node;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_snapshot_clear_subsurface (GtkSnapshotState *state)
|
||||
{
|
||||
g_object_unref (state->data.subsurface.subsurface);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_snapshot_push_subsurface (GtkSnapshot *snapshot,
|
||||
GdkSubsurface *subsurface)
|
||||
{
|
||||
const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot);
|
||||
GtkSnapshotState *state;
|
||||
|
||||
state = gtk_snapshot_push_state (snapshot,
|
||||
current_state->transform,
|
||||
gtk_snapshot_collect_subsurface,
|
||||
gtk_snapshot_clear_subsurface);
|
||||
|
||||
state->data.subsurface.subsurface = g_object_ref (subsurface);
|
||||
}
|
||||
|
@ -33,5 +33,8 @@ void gtk_snapshot_append_text (GtkSnapshot
|
||||
void gtk_snapshot_push_collect (GtkSnapshot *snapshot);
|
||||
GskRenderNode * gtk_snapshot_pop_collect (GtkSnapshot *snapshot);
|
||||
|
||||
void gtk_snapshot_push_subsurface (GtkSnapshot *snapshot,
|
||||
GdkSubsurface *subsurface);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user