snapshot: Remove clip argument from gtk_snapshot_new()
authorBenjamin Otte <otte@redhat.com>
Fri, 30 Mar 2018 13:39:25 +0000 (15:39 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 5 Apr 2018 12:56:38 +0000 (14:56 +0200)
It's not used anymore. And anybody who wants to have a clip on a
newly created snapshot can achieve that using gtk_snapshot_push_clip().

12 files changed:
gtk/gtkcolorbutton.c
gtk/gtkcolorswatch.c
gtk/gtkcssimage.c
gtk/gtkiconview.c
gtk/gtkoverlay.c
gtk/gtksnapshot.c
gtk/gtksnapshot.h
gtk/gtkstack.c
gtk/gtktextutil.c
gtk/gtktreeview.c
gtk/gtkwidget.c
tests/testlist3.c

index 084105a0f471738bc131bc101b93e76aa7ba854f..97c039f4a9a317a185a64b46867c557956290cfd 100644 (file)
@@ -326,7 +326,7 @@ set_color_icon (GdkDragContext *context,
   GtkSnapshot *snapshot;
   GdkPaintable *paintable;
 
-  snapshot = gtk_snapshot_new (FALSE, NULL, "ColorDragIcon");
+  snapshot = gtk_snapshot_new (FALSE, "ColorDragIcon");
   gtk_snapshot_append_color (snapshot,
                              rgba,
                              &GRAPHENE_RECT_INIT(0, 0, 48, 32),
index 5f4a8eeb41d400eb1956a0d0b1c22fbfb7137c17..acd58d84d99cba3b887100f860ddb31cdf0955b7 100644 (file)
@@ -170,7 +170,7 @@ drag_set_color_icon (GdkDragContext *context,
   GtkSnapshot *snapshot;
   GdkPaintable *paintable;
 
-  snapshot = gtk_snapshot_new (FALSE, NULL, "ColorDragIcon");
+  snapshot = gtk_snapshot_new (FALSE, "ColorDragIcon");
   gtk_snapshot_append_color (snapshot,
                              color,
                              &GRAPHENE_RECT_INIT(0, 0, 48, 32),
index fca30c97b66b4765edd067cb6de87bd7e4427e8d..842893eec28cec26e6cf4bc75375e703b17b65d6 100644 (file)
@@ -243,7 +243,6 @@ _gtk_css_image_draw (GtkCssImage        *image,
 {
   GtkSnapshot *snapshot;
   GskRenderNode *node;
-  cairo_region_t *clip;
 
   g_return_if_fail (GTK_IS_CSS_IMAGE (image));
   g_return_if_fail (cr != NULL);
@@ -252,8 +251,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 (FALSE, clip, "Fallback<%s>", G_OBJECT_TYPE_NAME (image));
+  snapshot = gtk_snapshot_new (FALSE, "Fallback<%s>", G_OBJECT_TYPE_NAME (image));
   gtk_css_image_snapshot (image, snapshot, width, height);
   node = gtk_snapshot_free_to_node (snapshot);
 
@@ -263,8 +261,6 @@ _gtk_css_image_draw (GtkCssImage        *image,
       gsk_render_node_unref (node);
     }
 
-  cairo_region_destroy (clip);
-
   cairo_restore (cr);
 }
 
index 64121b19d33c723320d1dba5075c159372fa7b5d..4c431e1b96ed5bf3384278aac7234ab07ec5c10d 100644 (file)
@@ -6708,7 +6708,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
       
       if (index == item->index)
         {
-          snapshot = gtk_snapshot_new (FALSE, NULL, "IconView DragIcon");
+          snapshot = gtk_snapshot_new (FALSE, "IconView DragIcon");
           gtk_icon_view_snapshot_item (icon_view, snapshot, item,
                                        icon_view->priv->item_padding,
                                        icon_view->priv->item_padding,
index 54230b687920bbf0704ca822b668662cc00eac6b..f101bce05b8db390df7f6c6a984883dfdc7eec2b 100644 (file)
@@ -675,7 +675,6 @@ gtk_overlay_snapshot (GtkWidget   *widget,
               GtkSnapshot *child_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);
               gtk_widget_snapshot (main_widget, child_snapshot);
index 05b07aa5f7c5d5f90ad5523711deefe803c4573a..4a0cdd9865f7b0724ce6b9feee4e8eef328de551 100644 (file)
@@ -198,7 +198,6 @@ gtk_snapshot_new_internal (gboolean        record_names,
 /**
  * gtk_snapshot_new:
  * @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
  * @...: arguments for @name
  *
@@ -207,9 +206,8 @@ gtk_snapshot_new_internal (gboolean        record_names,
  * Returns: a newly-allocated #GtkSnapshot
  */
 GtkSnapshot *
-gtk_snapshot_new (gboolean              record_names,
-                  const cairo_region_t *clip,
-                  const char           *name,
+gtk_snapshot_new (gboolean    record_names,
+                  const char *name,
                   ...)
 {
   char *str;
@@ -226,7 +224,7 @@ gtk_snapshot_new (gboolean              record_names,
     str = NULL;
 
   return gtk_snapshot_new_internal (record_names,
-                                    (cairo_region_t *) clip,
+                                    NULL,
                                     str);
 }
 
index add8cdd0b5bdfb198336adecb2f77af1464b2877..05de9ab599810d23da16ab1ed9e86427bc2e0a73 100644 (file)
@@ -53,9 +53,8 @@ GType           gtk_snapshot_get_type                   (void) G_GNUC_CONST;
 
 GDK_AVAILABLE_IN_ALL
 GtkSnapshot *   gtk_snapshot_new                        (gboolean                record_names,
-                                                         const cairo_region_t   *clip,
                                                          const char             *name,
-                                                         ...) G_GNUC_PRINTF (3, 4);
+                                                         ...) G_GNUC_PRINTF (2, 3);
 GDK_AVAILABLE_IN_ALL
 GskRenderNode * gtk_snapshot_free_to_node               (GtkSnapshot            *snapshot);
 GDK_AVAILABLE_IN_ALL
index 0b05f42352a423b83df2b49b39ec0accfaa2805b..a774abddf4dca3250b17ea2b16237a9a2be80ec5 100644 (file)
@@ -1946,7 +1946,6 @@ 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_record_names (snapshot),
-                                                        NULL,
                                                         "StackCaptureLastVisibleChild");
               gtk_widget_snapshot (priv->last_visible_child->widget, last_visible_snapshot);
               priv->last_visible_node = gtk_snapshot_free_to_node (last_visible_snapshot);
index ae17123e0ae29cba1ed3d6395368cfeb20e24c50..2507da9a843f7900760277bc904da1ffc8ce7350 100644 (file)
@@ -226,7 +226,7 @@ gtk_text_util_create_drag_icon (GtkWidget *widget,
 
   limit_layout_lines (layout);
 
-  snapshot = gtk_snapshot_new (FALSE, NULL, "TextDragIcon");
+  snapshot = gtk_snapshot_new (FALSE, "TextDragIcon");
 
   style_context = gtk_widget_get_style_context (widget);
   gtk_style_context_get_color (style_context,
@@ -332,7 +332,7 @@ gtk_text_util_create_rich_drag_icon (GtkWidget     *widget,
   layout_width = MIN (layout_width, DRAG_ICON_MAX_WIDTH);
   layout_height = MIN (layout_height, DRAG_ICON_MAX_HEIGHT);
 
-  snapshot = gtk_snapshot_new (FALSE, NULL, "RichTextDragIcon");
+  snapshot = gtk_snapshot_new (FALSE, "RichTextDragIcon");
   cr = gtk_snapshot_append_cairo (snapshot,
                                   &GRAPHENE_RECT_INIT (0, 0, layout_width, layout_height),
                                   "Text");
index 39b719330876b2ca341a6e69548dca19bb38c453..2ef45e0d9a8c430b1bae9bcbcb512e8d5eedfce7 100644 (file)
@@ -13868,7 +13868,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView  *tree_view,
 
   bin_window_width = gtk_widget_get_width (GTK_WIDGET (tree_view));
 
-  snapshot = gtk_snapshot_new (FALSE, NULL, "TreeView DragIcon");
+  snapshot = gtk_snapshot_new (FALSE, "TreeView DragIcon");
 
   gtk_snapshot_render_background (snapshot, context,
                                   0, 0,
index b45ad3dd9bf943176d797af5cb75da1186089cab..14f121b31ab6b6d655e88dd9c17757d70941467a 100644 (file)
@@ -5320,15 +5320,9 @@ gtk_widget_draw_internal (GtkWidget *widget,
       if (mode == RENDER_SNAPSHOT)
         {
           GtkSnapshot *snapshot;
-          cairo_region_t *clip;
           GskRenderNode *node;
 
-          clip = cairo_region_create_rectangle (&(cairo_rectangle_int_t) {
-                                                widget->priv->clip.x - widget->priv->allocation.x,
-                                                widget->priv->clip.y - widget->priv->allocation.y,
-                                                widget->priv->clip.width,
-                                                widget->priv->clip.height});
-          snapshot = gtk_snapshot_new (FALSE, clip, "Fallback<%s>", G_OBJECT_TYPE_NAME (widget));
+          snapshot = gtk_snapshot_new (FALSE, "Fallback<%s>", G_OBJECT_TYPE_NAME (widget));
           gtk_widget_snapshot (widget, snapshot);
           node = gtk_snapshot_free_to_node (snapshot);
           if (node != NULL)
@@ -5336,8 +5330,6 @@ gtk_widget_draw_internal (GtkWidget *widget,
               gsk_render_node_draw (node, cr);
               gsk_render_node_unref (node);
             }
-
-          cairo_region_destroy (clip);
         }
       else
         {
@@ -13887,7 +13879,6 @@ gtk_widget_render (GtkWidget            *widget,
     return;
 
   snapshot = gtk_snapshot_new (should_record_names (widget, renderer),
-                               NULL,
                                "Render<%s>", G_OBJECT_TYPE_NAME (widget));
   gtk_widget_snapshot (widget, snapshot);
   root = gtk_snapshot_free_to_node (snapshot);
index f11b01146de4e319924efbf6ea7908e4a45d734f..cfd1bcb6dac38778cd4d51b610b999286b06cd9a 100644 (file)
@@ -18,7 +18,7 @@ drag_begin (GtkWidget      *widget,
 
   row = gtk_widget_get_ancestor (widget, GTK_TYPE_LIST_BOX_ROW);
   gtk_widget_get_allocation (row, &alloc);
-  snapshot = gtk_snapshot_new (FALSE, NULL, "DragIcon");
+  snapshot = gtk_snapshot_new (FALSE, "DragIcon");
   cr = gtk_snapshot_append_cairo (snapshot,
                                   &GRAPHENE_RECT_INIT(0, 0, alloc.width, alloc.height),
                                   "DragText");