mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
snapshot: Remove renderer
Now that there's no longer a need to keep the renderer around for Cairo rendering, don't do that then.
This commit is contained in:
parent
e84c6acc4f
commit
1cfa88ed91
@ -253,7 +253,7 @@ _gtk_css_image_draw (GtkCssImage *image,
|
||||
cairo_save (cr);
|
||||
|
||||
clip = cairo_region_create_rectangle (&(cairo_rectangle_int_t) { 0, 0, width, height });
|
||||
snapshot = gtk_snapshot_new (NULL, FALSE, clip, "Fallback<%s>", G_OBJECT_TYPE_NAME (image));
|
||||
snapshot = gtk_snapshot_new (FALSE, clip, "Fallback<%s>", G_OBJECT_TYPE_NAME (image));
|
||||
gtk_css_image_snapshot (image, snapshot, width, height);
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
|
||||
|
@ -6724,7 +6724,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
|
||||
rect.width,
|
||||
rect.height);
|
||||
|
||||
snapshot = gtk_snapshot_new (NULL, FALSE, NULL, "IconView DragIcon");
|
||||
snapshot = gtk_snapshot_new (FALSE, NULL, "IconView DragIcon");
|
||||
gtk_icon_view_snapshot_item (icon_view, snapshot, item,
|
||||
icon_view->priv->item_padding,
|
||||
icon_view->priv->item_padding,
|
||||
|
@ -115,8 +115,7 @@ gtk_magnifier_snapshot (GtkWidget *widget,
|
||||
|
||||
g_signal_handler_block (priv->inspected, priv->draw_handler);
|
||||
|
||||
inspected_snapshot = gtk_snapshot_new (gtk_snapshot_get_renderer (snapshot),
|
||||
gtk_snapshot_get_record_names (snapshot),
|
||||
inspected_snapshot = gtk_snapshot_new (gtk_snapshot_get_record_names (snapshot),
|
||||
NULL,
|
||||
"MagnifierSnapshot");
|
||||
|
||||
|
@ -675,8 +675,7 @@ gtk_overlay_snapshot (GtkWidget *widget,
|
||||
{
|
||||
GtkSnapshot *child_snapshot;
|
||||
|
||||
child_snapshot = gtk_snapshot_new (gtk_snapshot_get_renderer (snapshot),
|
||||
gtk_snapshot_get_record_names (snapshot),
|
||||
child_snapshot = gtk_snapshot_new (gtk_snapshot_get_record_names (snapshot),
|
||||
NULL,
|
||||
"OverlayCaptureMainChild");
|
||||
gtk_snapshot_offset (child_snapshot, main_alloc.x, main_alloc.y);
|
||||
|
@ -157,7 +157,6 @@ gtk_snapshot_state_clear (GtkSnapshotState *state)
|
||||
|
||||
/**
|
||||
* gtk_snapshot_new:
|
||||
* @renderer: the #GskRenderer to create nodes for
|
||||
* @record_names: whether to keep node names (for debugging purposes)
|
||||
* @clip: (nullable): the clip region to use, or %NULL
|
||||
* @name: a printf-style format string to create the node name
|
||||
@ -168,8 +167,7 @@ gtk_snapshot_state_clear (GtkSnapshotState *state)
|
||||
* Returns: a newly-allocated #GtkSnapshot
|
||||
*/
|
||||
GtkSnapshot *
|
||||
gtk_snapshot_new (GskRenderer *renderer,
|
||||
gboolean record_names,
|
||||
gtk_snapshot_new (gboolean record_names,
|
||||
const cairo_region_t *clip,
|
||||
const char *name,
|
||||
...)
|
||||
@ -191,7 +189,6 @@ gtk_snapshot_new (GskRenderer *renderer,
|
||||
snapshot = g_object_new (GTK_TYPE_SNAPSHOT, NULL);
|
||||
|
||||
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);
|
||||
@ -1199,21 +1196,6 @@ gtk_snapshot_pop (GtkSnapshot *snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_get_renderer:
|
||||
* @snapshot: a #GtkSnapshot
|
||||
*
|
||||
* Obtains the #GskRenderer that this snapshot will be
|
||||
* rendered with.
|
||||
*
|
||||
* Returns: (transfer none): the #GskRenderer
|
||||
*/
|
||||
GskRenderer *
|
||||
gtk_snapshot_get_renderer (GtkSnapshot *snapshot)
|
||||
{
|
||||
return snapshot->renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_get_record_names:
|
||||
* @snapshot: a #GtkSnapshot
|
||||
|
@ -52,19 +52,16 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_snapshot_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkSnapshot * gtk_snapshot_new (GskRenderer *renderer,
|
||||
gboolean record_names,
|
||||
GtkSnapshot * gtk_snapshot_new (gboolean record_names,
|
||||
const cairo_region_t *clip,
|
||||
const char *name,
|
||||
...) G_GNUC_PRINTF (4, 5);
|
||||
...) G_GNUC_PRINTF (3, 4);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderNode * gtk_snapshot_free_to_node (GtkSnapshot *snapshot);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderNode * gtk_snapshot_to_node (GtkSnapshot *snapshot);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderer * gtk_snapshot_get_renderer (GtkSnapshot *snapshot);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_snapshot_get_record_names (GtkSnapshot *snapshot);
|
||||
|
||||
|
@ -89,7 +89,6 @@ struct _GdkSnapshot {
|
||||
GObject parent_instance; /* it's really GdkSnapshot, but don't tell anyone! */
|
||||
|
||||
gboolean record_names;
|
||||
GskRenderer *renderer;
|
||||
GArray *state_stack;
|
||||
GPtrArray *nodes;
|
||||
};
|
||||
|
@ -1956,8 +1956,7 @@ gtk_stack_snapshot (GtkWidget *widget,
|
||||
|
||||
gtk_widget_get_allocation (priv->last_visible_child->widget,
|
||||
&priv->last_visible_surface_allocation);
|
||||
last_visible_snapshot = gtk_snapshot_new (gtk_snapshot_get_renderer (snapshot),
|
||||
gtk_snapshot_get_record_names (snapshot),
|
||||
last_visible_snapshot = gtk_snapshot_new (gtk_snapshot_get_record_names (snapshot),
|
||||
NULL,
|
||||
"StackCaptureLastVisibleChild");
|
||||
gtk_widget_snapshot (priv->last_visible_child->widget, last_visible_snapshot);
|
||||
|
@ -13860,7 +13860,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
|
||||
bin_window_width + 2,
|
||||
background_area.height + 2);
|
||||
|
||||
snapshot = gtk_snapshot_new (NULL, FALSE, NULL, "TreeView DragIcon");
|
||||
snapshot = gtk_snapshot_new (FALSE, NULL, "TreeView DragIcon");
|
||||
|
||||
gtk_snapshot_render_background (snapshot, context,
|
||||
0, 0,
|
||||
|
@ -5444,7 +5444,6 @@ gtk_widget_draw_internal (GtkWidget *widget,
|
||||
|
||||
if (mode == RENDER_SNAPSHOT)
|
||||
{
|
||||
GskRenderer *renderer = gtk_widget_get_renderer (widget);
|
||||
GtkSnapshot *snapshot;
|
||||
cairo_region_t *clip;
|
||||
GskRenderNode *node;
|
||||
@ -5454,7 +5453,7 @@ gtk_widget_draw_internal (GtkWidget *widget,
|
||||
widget->priv->clip.y - widget->priv->allocation.y,
|
||||
widget->priv->clip.width,
|
||||
widget->priv->clip.height});
|
||||
snapshot = gtk_snapshot_new (renderer, FALSE, clip, "Fallback<%s>", G_OBJECT_TYPE_NAME (widget));
|
||||
snapshot = gtk_snapshot_new (FALSE, clip, "Fallback<%s>", G_OBJECT_TYPE_NAME (widget));
|
||||
gtk_widget_snapshot (widget, snapshot);
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
if (node != NULL)
|
||||
@ -13982,8 +13981,7 @@ gtk_widget_render (GtkWidget *widget,
|
||||
context = gsk_renderer_begin_draw_frame (renderer, region);
|
||||
clip = gdk_drawing_context_get_clip (context);
|
||||
|
||||
snapshot = gtk_snapshot_new (renderer,
|
||||
should_record_names (widget, renderer),
|
||||
snapshot = gtk_snapshot_new (should_record_names (widget, renderer),
|
||||
clip,
|
||||
"Render<%s>", G_OBJECT_TYPE_NAME (widget));
|
||||
cairo_region_destroy (clip);
|
||||
|
Loading…
Reference in New Issue
Block a user