Export more snapshot api
We currently don't export enough api to do custom snapshots outside libgtk. To demonstrate this in gtk4-demo, export the necessary api here.
This commit is contained in:
@@ -125,13 +125,13 @@ gtk_snapshot_state_clear (GtkSnapshotState *state)
|
||||
g_clear_pointer (&state->name, g_free);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_snapshot_init (GtkSnapshot *snapshot,
|
||||
GskRenderer *renderer,
|
||||
gboolean record_names,
|
||||
const cairo_region_t *clip,
|
||||
const char *name,
|
||||
...)
|
||||
static void
|
||||
gtk_snapshot_init_va (GtkSnapshot *snapshot,
|
||||
GskRenderer *renderer,
|
||||
gboolean record_names,
|
||||
const cairo_region_t *clip,
|
||||
const char *name,
|
||||
va_list args)
|
||||
{
|
||||
char *str;
|
||||
|
||||
@@ -142,13 +142,7 @@ gtk_snapshot_init (GtkSnapshot *snapshot,
|
||||
snapshot->nodes = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_render_node_unref);
|
||||
|
||||
if (name && record_names)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, name);
|
||||
str = g_strdup_vprintf (name, args);
|
||||
va_end (args);
|
||||
}
|
||||
str = g_strdup_vprintf (name, args);
|
||||
else
|
||||
str = NULL;
|
||||
|
||||
@@ -159,6 +153,38 @@ gtk_snapshot_init (GtkSnapshot *snapshot,
|
||||
gtk_snapshot_collect_default);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_snapshot_init (GtkSnapshot *snapshot,
|
||||
GskRenderer *renderer,
|
||||
gboolean record_names,
|
||||
const cairo_region_t *clip,
|
||||
const char *name,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, name);
|
||||
gtk_snapshot_init_va (snapshot, renderer, record_names, clip, name, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
GtkSnapshot *
|
||||
gtk_snapshot_new (GtkSnapshot *parent,
|
||||
const char *name,
|
||||
...)
|
||||
{
|
||||
GtkSnapshot *snapshot;
|
||||
va_list args;
|
||||
|
||||
snapshot = g_new (GtkSnapshot, 1);
|
||||
|
||||
va_start (args, name);
|
||||
gtk_snapshot_init_va (snapshot, parent->renderer, parent->record_names, NULL, name, args);
|
||||
va_end (args);
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_push:
|
||||
* @snapshot: a #GtkSnapshot
|
||||
@@ -1021,6 +1047,17 @@ gtk_snapshot_finish (GtkSnapshot *snapshot)
|
||||
return result;
|
||||
}
|
||||
|
||||
GskRenderNode *
|
||||
gtk_snapshot_free (GtkSnapshot *snapshot)
|
||||
{
|
||||
GskRenderNode *node;
|
||||
|
||||
node = gtk_snapshot_finish (snapshot);
|
||||
g_free (snapshot);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_pop:
|
||||
* @snapshot: a #GtkSnapshot
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GDK_AVAILABLE_IN_3_92
|
||||
GtkSnapshot * gtk_snapshot_new (GtkSnapshot *parent,
|
||||
const char *name,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
GDK_AVAILABLE_IN_3_92
|
||||
GskRenderNode * gtk_snapshot_free (GtkSnapshot *snapshot);
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
void gtk_snapshot_push (GtkSnapshot *snapshot,
|
||||
gboolean keep_coordinates,
|
||||
|
||||
@@ -87,14 +87,17 @@ struct _GtkSnapshot {
|
||||
GPtrArray *nodes;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_init (GtkSnapshot *state,
|
||||
GskRenderer *renderer,
|
||||
gboolean record_names,
|
||||
const cairo_region_t *clip,
|
||||
const char *name,
|
||||
...) G_GNUC_PRINTF (5, 6);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderNode * gtk_snapshot_finish (GtkSnapshot *state);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderer * gtk_snapshot_get_renderer (const GtkSnapshot *snapshot);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -518,6 +518,10 @@ void gtk_widget_unrealize (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
GDK_AVAILABLE_IN_3_92
|
||||
void gtk_widget_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot);
|
||||
|
||||
/* Queuing draws */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_queue_draw (GtkWidget *widget);
|
||||
|
||||
@@ -282,9 +282,6 @@ void gtk_widget_render (GtkWidget
|
||||
GdkWindow *window,
|
||||
const cairo_region_t *region);
|
||||
|
||||
|
||||
void gtk_widget_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot);
|
||||
void gtk_widget_adjust_size_request (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
gint *minimum_size,
|
||||
|
||||
Reference in New Issue
Block a user