From 1cfa88ed913e795a88214a87388801d2850fa75e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 24 Mar 2018 21:41:53 +0100 Subject: [PATCH] snapshot: Remove renderer Now that there's no longer a need to keep the renderer around for Cairo rendering, don't do that then. --- gtk/gtkcssimage.c | 2 +- gtk/gtkiconview.c | 2 +- gtk/gtkmagnifier.c | 3 +-- gtk/gtkoverlay.c | 3 +-- gtk/gtksnapshot.c | 20 +------------------- gtk/gtksnapshot.h | 7 ++----- gtk/gtksnapshotprivate.h | 1 - gtk/gtkstack.c | 3 +-- gtk/gtktreeview.c | 2 +- gtk/gtkwidget.c | 6 ++---- 10 files changed, 11 insertions(+), 38 deletions(-) diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c index c61c3ee4a5..fca30c97b6 100644 --- a/gtk/gtkcssimage.c +++ b/gtk/gtkcssimage.c @@ -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); diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index e90e68b8a7..65af792f8e 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -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, diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c index fbcab5733c..9b1e8b7a1b 100644 --- a/gtk/gtkmagnifier.c +++ b/gtk/gtkmagnifier.c @@ -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"); diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c index d12381bd84..2e8f4dc2f9 100644 --- a/gtk/gtkoverlay.c +++ b/gtk/gtkoverlay.c @@ -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); diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index 201c7c2fb5..cc8bd80b50 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -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 diff --git a/gtk/gtksnapshot.h b/gtk/gtksnapshot.h index e9852f8b96..c8003956fe 100644 --- a/gtk/gtksnapshot.h +++ b/gtk/gtksnapshot.h @@ -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); diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h index d6e534deef..920da7917d 100644 --- a/gtk/gtksnapshotprivate.h +++ b/gtk/gtksnapshotprivate.h @@ -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; }; diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index 22efd3250e..a5c46ba2cf 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -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); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 9547052721..644f21ae22 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -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, diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index b551edb018..3d66f3e191 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -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);