GtkSnapshot: Drop init/finish

We are ont using stack-allocated snapshots anymore.
This commit is contained in:
Matthias Clasen 2018-03-10 21:20:25 -05:00
parent 694f1d8ecd
commit eed279ad91
2 changed files with 11 additions and 61 deletions

View File

@ -156,52 +156,6 @@ gtk_snapshot_state_clear (GtkSnapshotState *state)
g_clear_pointer (&state->name, g_free); g_clear_pointer (&state->name, g_free);
} }
static void
gtk_snapshot_init_internal (GtkSnapshot *snapshot,
GskRenderer *renderer,
gboolean record_names,
const cairo_region_t *clip,
char *name)
{
snapshot->record_names = record_names;
snapshot->renderer = renderer;
snapshot->state_stack = g_array_new (FALSE, TRUE, sizeof (GtkSnapshotState));
g_array_set_clear_func (snapshot->state_stack, (GDestroyNotify)gtk_snapshot_state_clear);
snapshot->nodes = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_render_node_unref);
gtk_snapshot_push_state (snapshot,
name,
(cairo_region_t *) clip,
0, 0,
gtk_snapshot_collect_default);
}
void
gtk_snapshot_init (GtkSnapshot *snapshot,
GskRenderer *renderer,
gboolean record_names,
const cairo_region_t *clip,
const char *name,
...)
{
char *str;
if (name && record_names)
{
va_list args;
va_start (args, name);
str = g_strdup_vprintf (name, args);
va_end (args);
}
else
str = NULL;
snapshot->ref_count = 0;
gtk_snapshot_init_internal (snapshot, renderer, record_names, clip, str);
}
GtkSnapshot * GtkSnapshot *
gtk_snapshot_new (GskRenderer *renderer, gtk_snapshot_new (GskRenderer *renderer,
gboolean record_names, gboolean record_names,
@ -226,7 +180,17 @@ gtk_snapshot_new (GskRenderer *renderer,
snapshot = g_new (GtkSnapshot, 1); snapshot = g_new (GtkSnapshot, 1);
snapshot->ref_count = 1; snapshot->ref_count = 1;
gtk_snapshot_init_internal (snapshot, renderer, record_names, clip, str); snapshot->record_names = record_names;
snapshot->renderer = renderer;
snapshot->state_stack = g_array_new (FALSE, TRUE, sizeof (GtkSnapshotState));
g_array_set_clear_func (snapshot->state_stack, (GDestroyNotify)gtk_snapshot_state_clear);
snapshot->nodes = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_render_node_unref);
gtk_snapshot_push_state (snapshot,
str,
(cairo_region_t *) clip,
0, 0,
gtk_snapshot_collect_default);
return snapshot; return snapshot;
} }
@ -1180,12 +1144,6 @@ gtk_snapshot_to_node (GtkSnapshot *snapshot)
return result; return result;
} }
GskRenderNode *
gtk_snapshot_finish (GtkSnapshot *snapshot)
{
return gtk_snapshot_to_node (snapshot);
}
/** /**
* gtk_snapshot_pop: * gtk_snapshot_pop:
* @snapshot: a #GtkSnapshot * @snapshot: a #GtkSnapshot

View File

@ -88,14 +88,6 @@ struct _GtkSnapshot {
GPtrArray *nodes; GPtrArray *nodes;
}; };
void gtk_snapshot_init (GtkSnapshot *state,
GskRenderer *renderer,
gboolean record_names,
const cairo_region_t *clip,
const char *name,
...) G_GNUC_PRINTF (5, 6);
GskRenderNode * gtk_snapshot_finish (GtkSnapshot *state);
GskRenderer * gtk_snapshot_get_renderer (const GtkSnapshot *snapshot); GskRenderer * gtk_snapshot_get_renderer (const GtkSnapshot *snapshot);
G_END_DECLS G_END_DECLS