diff options
author | Benjamin Otte <otte@redhat.com> | 2018-04-24 03:17:23 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2018-04-24 04:06:58 +0200 |
commit | 73b4a62f5101473cf585f844579922a0e03c376a (patch) | |
tree | e728288a7072b8170e48b126e418353c193389c2 | |
parent | 49f9d2108dbde96d2d5555f737db0183e4002a8a (diff) | |
download | gtk+-73b4a62f5101473cf585f844579922a0e03c376a.tar.gz |
snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
67 files changed, 316 insertions, 828 deletions
diff --git a/demos/gtk-demo/fontplane.c b/demos/gtk-demo/fontplane.c index 6df1bfe7f7..ce81ecce95 100644 --- a/demos/gtk-demo/fontplane.c +++ b/demos/gtk-demo/fontplane.c @@ -68,8 +68,7 @@ plane_snapshot (GtkWidget *widget, height = gtk_widget_get_allocated_height (widget); cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "FontPlane"); + &GRAPHENE_RECT_INIT (0, 0, width, height)); cairo_set_source_rgb (cr, 0, 0, 0); cairo_rectangle (cr, 0, 0, width, height); diff --git a/demos/gtk-demo/paint.c b/demos/gtk-demo/paint.c index c4c9ae0caa..a451a677c8 100644 --- a/demos/gtk-demo/paint.c +++ b/demos/gtk-demo/paint.c @@ -102,8 +102,7 @@ drawing_area_snapshot (GtkWidget *widget, 0, 0, allocation.width, allocation.height - ), - "DrawingArea"); + )); cairo_set_source_rgb (cr, 1, 1, 1); cairo_paint (cr); diff --git a/demos/gtk-demo/paintable.c b/demos/gtk-demo/paintable.c index da7e22d208..3d20e99984 100644 --- a/demos/gtk-demo/paintable.c +++ b/demos/gtk-demo/paintable.c @@ -56,15 +56,13 @@ gtk_nuclear_snapshot (GtkSnapshot *snapshot, gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "Yellow background"); + &GRAPHENE_RECT_INIT (0, 0, width, height)); size = MIN (width, height); cr = gtk_snapshot_append_cairo (snapshot, &GRAPHENE_RECT_INIT ((width - size) / 2.0, (height - size) / 2.0, - size, size), - "Radioactive Icon"); + size, size)); cairo_translate (cr, width / 2.0, height / 2.0); cairo_scale (cr, size, size); cairo_rotate (cr, rotation); diff --git a/gdk/gdkpaintable.c b/gdk/gdkpaintable.c index efb4ea2ac3..24ee62225a 100644 --- a/gdk/gdkpaintable.c +++ b/gdk/gdkpaintable.c @@ -23,6 +23,12 @@ #include "gdksnapshotprivate.h" +/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */ +void gtk_snapshot_push_debug (GdkSnapshot *snapshot, + const char *message, + ...) G_GNUC_PRINTF (2, 3); +void gtk_snapshot_pop (GdkSnapshot *snapshot); + /** * SECTION:paintable * @Title: GdkPaintable @@ -206,8 +212,12 @@ gdk_paintable_snapshot (GdkPaintable *paintable, if (width <= 0.0 || height <= 0.0) return; + gtk_snapshot_push_debug (snapshot, "%s %p @ %gx%g", G_OBJECT_TYPE_NAME (paintable), paintable, width, height); + iface = GDK_PAINTABLE_GET_IFACE (paintable); iface->snapshot (paintable, snapshot, width, height); + + gtk_snapshot_pop (snapshot); } #define GDK_PAINTABLE_IMMUTABLE (GDK_PAINTABLE_STATIC_SIZE | GDK_PAINTABLE_STATIC_CONTENTS) diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c index 3e5f0a401a..73c7f85dbf 100644 --- a/gdk/gdktexture.c +++ b/gdk/gdktexture.c @@ -47,9 +47,7 @@ void gtk_snapshot_append_texture (GdkSnapshot *snapshot, GdkTexture *texture, - const graphene_rect_t *bounds, - const char *name, - ...) G_GNUC_PRINTF (4, 5); + const graphene_rect_t *bounds); /** * SECTION:gdktexture @@ -93,10 +91,7 @@ gdk_texture_paintable_snapshot (GdkPaintable *paintable, gtk_snapshot_append_texture (snapshot, self, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "%s as paintable %dx%d", - G_OBJECT_TYPE_NAME (paintable), - self->width, self->height); + &GRAPHENE_RECT_INIT (0, 0, width, height)); } static GdkPaintableFlags diff --git a/gtk/gskpango.c b/gtk/gskpango.c index a486b81add..20bff5e9c2 100644 --- a/gtk/gskpango.c +++ b/gtk/gskpango.c @@ -46,7 +46,6 @@ struct _GskPangoRenderer GtkSnapshot *snapshot; GdkRGBA fg_color; graphene_rect_t bounds; - char *name; /* house-keeping options */ gboolean is_cached_renderer; @@ -147,13 +146,6 @@ gsk_pango_renderer_show_text_glyphs (PangoRenderer *renderer, if (node == NULL) return; - if (gtk_snapshot_get_record_names (crenderer->snapshot)) - { - char *s = g_strdup_printf ("%s<%d>", crenderer->name, glyphs->num_glyphs); - gsk_render_node_set_name (node, s); - g_free (s); - } - gtk_snapshot_append_node_internal (crenderer->snapshot, node); gsk_render_node_unref (node); } @@ -199,7 +191,7 @@ gsk_pango_renderer_draw_rectangle (PangoRenderer *renderer, (double)x / PANGO_SCALE, (double)y / PANGO_SCALE, (double)width / PANGO_SCALE, (double)height / PANGO_SCALE); - gtk_snapshot_append_color (crenderer->snapshot, &rgba, &bounds, "DrawRectangle"); + gtk_snapshot_append_color (crenderer->snapshot, &rgba, &bounds); } static void @@ -216,7 +208,7 @@ gsk_pango_renderer_draw_trapezoid (PangoRenderer *renderer, cairo_t *cr; gdouble x, y; - cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds, "DrawTrapezoid"); + cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds); set_color (crenderer, part, cr); @@ -319,7 +311,7 @@ gsk_pango_renderer_draw_error_underline (PangoRenderer *renderer, GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer); cairo_t *cr; - cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds, "DrawTrapezoid"); + cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds); set_color (crenderer, PANGO_RENDER_PART_UNDERLINE, cr); @@ -348,7 +340,7 @@ gsk_pango_renderer_draw_shape (PangoRenderer *renderer, double base_x = (double)x / PANGO_SCALE; double base_y = (double)y / PANGO_SCALE; - cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds, "DrawShape"); + cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds); layout = pango_renderer_get_layout (renderer); if (!layout) @@ -419,7 +411,6 @@ release_renderer (GskPangoRenderer *renderer) if (G_LIKELY (renderer->is_cached_renderer)) { renderer->snapshot = NULL; - g_clear_pointer (&renderer->name, g_free); G_UNLOCK (cached_renderer); } @@ -432,19 +423,15 @@ release_renderer (GskPangoRenderer *renderer) * @snapshot: a #GtkSnapshot * @layout: the #PangoLayout to render * @color: the foreground color to render the layout in - * @name: (transfer none): a printf() style format string for the name for the new node - * @...: arguments to insert into the format string * * Creates render nodes for rendering @layout in the given foregound @color * and appends them to the current node of @snapshot without changing the * current node. **/ void -gtk_snapshot_append_layout (GtkSnapshot *snapshot, - PangoLayout *layout, - const GdkRGBA *color, - const char *name, - ...) +gtk_snapshot_append_layout (GtkSnapshot *snapshot, + PangoLayout *layout, + const GdkRGBA *color) { GskPangoRenderer *crenderer; PangoRectangle ink_rect; @@ -456,16 +443,6 @@ gtk_snapshot_append_layout (GtkSnapshot *snapshot, crenderer->snapshot = snapshot; crenderer->fg_color = *color; - if (name && gtk_snapshot_get_record_names (crenderer->snapshot)) - { - va_list args; - - va_start (args, name); - crenderer->name = g_strdup_vprintf (name, args); - va_end (args); - } - else - crenderer->name = NULL; pango_layout_get_pixel_extents (layout, &ink_rect, NULL); graphene_rect_init (&crenderer->bounds, ink_rect.x, ink_rect.y, ink_rect.width, ink_rect.height); diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 643bbf9ddb..219be68481 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -2325,8 +2325,7 @@ calendar_snapshot_day (GtkCalendar *calendar, &GRAPHENE_RECT_INIT ( day_rect.x + 2, y_loc, day_rect.width - 2, 1 - ), - "CalendarDetailSeparator"); + )); y_loc += 2; } diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c index 9bbfd4a3ec..7c176b020c 100644 --- a/gtk/gtkcellrenderer.c +++ b/gtk/gtkcellrenderer.c @@ -707,6 +707,8 @@ gtk_cell_renderer_snapshot (GtkCellRenderer *cell, selected = (flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED; + gtk_snapshot_push_debug (snapshot, "%s", G_OBJECT_TYPE_NAME (cell)); + if (priv->cell_background_set && !selected) { gtk_snapshot_append_color (snapshot, @@ -714,16 +716,14 @@ gtk_cell_renderer_snapshot (GtkCellRenderer *cell, &GRAPHENE_RECT_INIT ( background_area->x, background_area->y, background_area->width, background_area->height - ), - "CellBackground"); + )); } gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT ( background_area->x, background_area->y, background_area->width, background_area->height - ), - "CellClip"); + )); context = gtk_widget_get_style_context (widget); @@ -741,6 +741,7 @@ gtk_cell_renderer_snapshot (GtkCellRenderer *cell, flags); gtk_style_context_restore (context); gtk_snapshot_pop (snapshot); + gtk_snapshot_pop (snapshot); } /** diff --git a/gtk/gtkcellrendererprogress.c b/gtk/gtkcellrendererprogress.c index ebacb72c6a..43f4b138b6 100644 --- a/gtk/gtkcellrendererprogress.c +++ b/gtk/gtkcellrendererprogress.c @@ -648,8 +648,7 @@ gtk_cell_renderer_progress_snapshot (GtkCellRenderer *cell, &GRAPHENE_RECT_INIT( clip.x, clip.y, clip.width, clip.height - ), - "CellProgressClip"); + )); gtk_style_context_save (context); gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR); @@ -681,8 +680,7 @@ gtk_cell_renderer_progress_snapshot (GtkCellRenderer *cell, &GRAPHENE_RECT_INIT( clip.x, clip.y, clip.width, clip.height - ), - "CellTroughClip"); + )); gtk_snapshot_render_layout (snapshot, context, x_pos, y_pos, @@ -708,8 +706,7 @@ gtk_cell_renderer_progress_snapshot (GtkCellRenderer *cell, &GRAPHENE_RECT_INIT( clip.x, clip.y, clip.width, clip.height - ), - "CellTroughClip"); + )); gtk_snapshot_render_layout (snapshot, context, x_pos, y_pos, diff --git a/gtk/gtkcellrendererspinner.c b/gtk/gtkcellrendererspinner.c index d14cdd2591..e68ec047bd 100644 --- a/gtk/gtkcellrendererspinner.c +++ b/gtk/gtkcellrendererspinner.c @@ -418,8 +418,7 @@ gtk_cell_renderer_spinner_snapshot (GtkCellRenderer *cellr, &GRAPHENE_RECT_INIT ( cell_area->x, cell_area->y, cell_area->width, cell_area->height - ), - "CellSpinner"); + )); gtk_paint_spinner (gtk_widget_get_style_context (widget), cr, diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c index 58c7367407..1e46ea0c56 100644 --- a/gtk/gtkcellrenderertext.c +++ b/gtk/gtkcellrenderertext.c @@ -1730,8 +1730,7 @@ gtk_cell_renderer_text_snapshot (GtkCellRenderer *cell, &GRAPHENE_RECT_INIT( background_area->x, background_area->y, background_area->width, background_area->height - ), - "CellTextBackground"); + )); } gtk_cell_renderer_get_padding (cell, &xpad, &ypad); @@ -1749,8 +1748,7 @@ gtk_cell_renderer_text_snapshot (GtkCellRenderer *cell, &GRAPHENE_RECT_INIT( cell_area->x, cell_area->y, cell_area->width, cell_area->height - ), - "CellTextClip"); + )); gtk_snapshot_render_layout (snapshot, context, cell_area->x + x_offset + xpad, diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c index 4f7225e369..f899f736e1 100644 --- a/gtk/gtkcellrenderertoggle.c +++ b/gtk/gtkcellrenderertoggle.c @@ -423,8 +423,7 @@ gtk_cell_renderer_toggle_snapshot (GtkCellRenderer *cell, &GRAPHENE_RECT_INIT ( cell_area->x, cell_area->y, cell_area->width, cell_area->height - ), - "CellToggleClip"); + )); context = gtk_cell_renderer_toggle_save_context (cell, widget); gtk_style_context_set_state (context, state); diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index d533866434..7bb6972a4a 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -325,11 +325,10 @@ set_color_icon (GdkDragContext *context, GtkSnapshot *snapshot; GdkPaintable *paintable; - snapshot = gtk_snapshot_new (FALSE, "ColorDragIcon"); + snapshot = gtk_snapshot_new (); gtk_snapshot_append_color (snapshot, rgba, - &GRAPHENE_RECT_INIT(0, 0, 48, 32), - "ColorDragColor"); + &GRAPHENE_RECT_INIT(0, 0, 48, 32)); paintable = gtk_snapshot_free_to_paintable (snapshot, NULL); gtk_drag_set_icon_paintable (context, paintable, 0, 0); diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c index c45adc2ba1..7162d7ebdf 100644 --- a/gtk/gtkcolorplane.c +++ b/gtk/gtkcolorplane.c @@ -84,11 +84,9 @@ plane_snapshot (GtkWidget *widget, gtk_snapshot_append_texture (snapshot, plane->priv->texture, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "ColorPlane"); + &GRAPHENE_RECT_INIT (0, 0, width, height)); cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "ColorPlane"); + &GRAPHENE_RECT_INIT (0, 0, width, height)); cairo_move_to (cr, 0, y + 0.5); cairo_line_to (cr, width, y + 0.5); diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c index 4f473084a4..1556259e08 100644 --- a/gtk/gtkcolorscale.c +++ b/gtk/gtkcolorscale.c @@ -103,8 +103,7 @@ gtk_color_scale_snapshot_trough (GtkColorScale *scale, gtk_snapshot_append_texture (snapshot, texture, - &GRAPHENE_RECT_INIT(x, y, width, height), - "ColorScaleHue"); + &GRAPHENE_RECT_INIT(x, y, width, height)); g_object_unref (texture); } else if (scale->priv->type == GTK_COLOR_SCALE_ALPHA) @@ -113,8 +112,7 @@ gtk_color_scale_snapshot_trough (GtkColorScale *scale, graphene_point_t start, end; cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT(x, y, width, height), - "ColorScaleAlpha"); + &GRAPHENE_RECT_INIT(x, y, width, height)); cairo_translate (cr, x, y); if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL && @@ -157,8 +155,7 @@ gtk_color_scale_snapshot_trough (GtkColorScale *scale, { 0, { color->red, color->green, color->blue, 0 } }, { 1, { color->red, color->green, color->blue, 1 } }, }, - 2, - "ColorAlphaGradient"); + 2); } } diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index 44a04c685b..7ce4eff673 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -117,17 +117,13 @@ swatch_snapshot (GtkWidget *widget, 0, 0, gtk_widget_get_width (widget), gtk_widget_get_height (widget)); - gtk_snapshot_push_rounded_clip (snapshot, - &content_box, - "ColorSwatchClip"); + gtk_snapshot_push_rounded_clip (snapshot, &content_box); if (swatch->priv->use_alpha && !gdk_rgba_is_opaque (&swatch->priv->color)) { cairo_t *cr; - cr = gtk_snapshot_append_cairo (snapshot, - &content_box.bounds, - "CheckeredBackground"); + cr = gtk_snapshot_append_cairo (snapshot, &content_box.bounds); cairo_set_source_rgb (cr, 0.33, 0.33, 0.33); cairo_paint (cr); @@ -143,8 +139,7 @@ swatch_snapshot (GtkWidget *widget, gtk_snapshot_append_color (snapshot, &swatch->priv->color, - &content_box.bounds, - "ColorSwatch Color"); + &content_box.bounds); } else { @@ -154,8 +149,7 @@ swatch_snapshot (GtkWidget *widget, gtk_snapshot_append_color (snapshot, &color, - &content_box.bounds, - "ColorSwatch Opaque Color"); + &content_box.bounds); } gtk_snapshot_pop (snapshot); @@ -172,11 +166,10 @@ drag_set_color_icon (GdkDragContext *context, GtkSnapshot *snapshot; GdkPaintable *paintable; - snapshot = gtk_snapshot_new (FALSE, "ColorDragIcon"); + snapshot = gtk_snapshot_new (); gtk_snapshot_append_color (snapshot, color, - &GRAPHENE_RECT_INIT(0, 0, 48, 32), - "ColorDragColor"); + &GRAPHENE_RECT_INIT(0, 0, 48, 32)); paintable = gtk_snapshot_free_to_paintable (snapshot, NULL); gtk_drag_set_icon_paintable (context, paintable, 4, 4); diff --git a/gtk/gtkcssfiltervalue.c b/gtk/gtkcssfiltervalue.c index 4f73e239a7..eaf79de37c 100644 --- a/gtk/gtkcssfiltervalue.c +++ b/gtk/gtkcssfiltervalue.c @@ -875,15 +875,14 @@ gtk_css_filter_value_push_snapshot (const GtkCssValue *filter, if (i < j) gtk_snapshot_push_color_matrix (snapshot, &matrix, - &offset, - "CssFilter ColorMatrix<%d-%d>", i, j); + &offset); if (j < filter->n_filters) { if (filter->filters[j].type == GTK_CSS_FILTER_BLUR) { radius = _gtk_css_number_value_get (filter->filters[j].blur.value, 100.0); - gtk_snapshot_push_blur (snapshot, radius, "CssFilter Blur<%d, radius %g>", j, radius); + gtk_snapshot_push_blur (snapshot, radius); } else g_warning ("Don't know how to handle filter type %d", filter->filters[j].type); diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c index 842893eec2..90919b0109 100644 --- a/gtk/gtkcssimage.c +++ b/gtk/gtkcssimage.c @@ -251,7 +251,7 @@ _gtk_css_image_draw (GtkCssImage *image, cairo_save (cr); - snapshot = gtk_snapshot_new (FALSE, "Fallback<%s>", G_OBJECT_TYPE_NAME (image)); + snapshot = gtk_snapshot_new (); gtk_css_image_snapshot (image, snapshot, width, height); node = gtk_snapshot_free_to_node (snapshot); diff --git a/gtk/gtkcssimagebuiltin.c b/gtk/gtkcssimagebuiltin.c index aedc2e8ff5..ee547f6c90 100644 --- a/gtk/gtkcssimagebuiltin.c +++ b/gtk/gtkcssimagebuiltin.c @@ -663,8 +663,7 @@ gtk_css_image_builtin_snapshot (GtkCssImage *image, } cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "BuiltinImage<%d>", (int) image_type); + &GRAPHENE_RECT_INIT (0, 0, width, height)); gtk_css_image_builtin_draw (image, cr, width, height, image_type); cairo_destroy (cr); } diff --git a/gtk/gtkcssimagecrossfade.c b/gtk/gtkcssimagecrossfade.c index 918ab2cae7..83dfd991a8 100644 --- a/gtk/gtkcssimagecrossfade.c +++ b/gtk/gtkcssimagecrossfade.c @@ -141,7 +141,7 @@ gtk_css_image_cross_fade_snapshot (GtkCssImage *image, { GtkCssImageCrossFade *cross_fade = GTK_CSS_IMAGE_CROSS_FADE (image); - gtk_snapshot_push_cross_fade (snapshot, cross_fade->progress, "CrossFadeImage<%g>", cross_fade->progress); + gtk_snapshot_push_cross_fade (snapshot, cross_fade->progress); if (cross_fade->start) gtk_css_image_snapshot (cross_fade->start, snapshot, width, height); diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c index 8f869ccac3..f109337468 100644 --- a/gtk/gtkcssimagefallback.c +++ b/gtk/gtkcssimagefallback.c @@ -78,7 +78,7 @@ gtk_css_image_fallback_snapshot (GtkCssImage *image, else color = &red; - gtk_snapshot_append_color (snapshot, color, &GRAPHENE_RECT_INIT (0, 0, width, height), "image() Fallback Color"); + gtk_snapshot_append_color (snapshot, color, &GRAPHENE_RECT_INIT (0, 0, width, height)); } else gtk_css_image_snapshot (fallback->images[fallback->used], snapshot, width, height); diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c index 32bfca025f..d481659a4c 100644 --- a/gtk/gtkcssimageicontheme.c +++ b/gtk/gtkcssimageicontheme.c @@ -111,7 +111,7 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image, }); graphene_vec4_init (&offset, fg.red, fg.green, fg.blue, 0); - gtk_snapshot_push_color_matrix (snapshot, &matrix, &offset, "Recolor"); + gtk_snapshot_push_color_matrix (snapshot, &matrix, &offset); } gtk_snapshot_append_texture (snapshot, @@ -121,8 +121,7 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image, (height - texture_height) / 2.0, texture_width, texture_height - ), - "CssImageIconTheme<%s@%d>", icon_theme->name, icon_theme->scale); + )); if (symbolic) gtk_snapshot_pop (snapshot); } diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c index 87cc64abc5..1253ed8bf9 100644 --- a/gtk/gtkcssimagelinear.c +++ b/gtk/gtkcssimagelinear.c @@ -186,8 +186,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image, gtk_snapshot_append_color (snapshot, _gtk_css_rgba_value_get_rgba (stop->color), - &GRAPHENE_RECT_INIT (0, 0, width, height), - "RepeatingLinearGradient<degenerate>"); + &GRAPHENE_RECT_INIT (0, 0, width, height)); return; } @@ -238,8 +237,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image, &GRAPHENE_POINT_INIT (width / 2 + x * (start - 0.5), height / 2 + y * (start - 0.5)), &GRAPHENE_POINT_INIT (width / 2 + x * (end - 0.5), height / 2 + y * (end - 0.5)), stops, - linear->stops->len, - "RepeatingLinearGradient<%ustops>", linear->stops->len); + linear->stops->len); } else { @@ -249,8 +247,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image, &GRAPHENE_POINT_INIT (width / 2 + x * (start - 0.5), height / 2 + y * (start - 0.5)), &GRAPHENE_POINT_INIT (width / 2 + x * (end - 0.5), height / 2 + y * (end - 0.5)), stops, - linear->stops->len, - "LinearGradient<%ustops>", linear->stops->len); + linear->stops->len); } } diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c index 88a0357022..3b426978c4 100644 --- a/gtk/gtkcssimageradial.c +++ b/gtk/gtkcssimageradial.c @@ -91,8 +91,7 @@ gtk_css_image_radial_snapshot (GtkCssImage *image, cairo_t *cr; cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "Fallback<%s>", G_OBJECT_TYPE_NAME (image)); + &GRAPHENE_RECT_INIT (0, 0, width, height)); x = _gtk_css_position_value_get_x (radial->position, width); y = _gtk_css_position_value_get_y (radial->position, height); diff --git a/gtk/gtkcssimagerecolor.c b/gtk/gtkcssimagerecolor.c index 41c95e99f4..39ba7bd6f5 100644 --- a/gtk/gtkcssimagerecolor.c +++ b/gtk/gtkcssimagerecolor.c @@ -192,14 +192,11 @@ gtk_css_image_recolor_snapshot (GtkCssImage *image, 0, 0, 0, fg.alpha }); graphene_vec4_init (&offset, fg.red, fg.green, fg.blue, 0); - gtk_snapshot_push_color_matrix (snapshot, &matrix, &offset, "Recolor"); + gtk_snapshot_push_color_matrix (snapshot, &matrix, &offset); gtk_snapshot_append_texture (snapshot, recolor->texture, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "Recolor Image %dx%d", - gdk_texture_get_width (recolor->texture), - gdk_texture_get_height (recolor->texture)); + &GRAPHENE_RECT_INIT (0, 0, width, height)); gtk_snapshot_pop (snapshot); } diff --git a/gtk/gtkcssimagewin32.c b/gtk/gtkcssimagewin32.c index 29eb13e650..2fad915882 100644 --- a/gtk/gtkcssimagewin32.c +++ b/gtk/gtkcssimagewin32.c @@ -37,8 +37,7 @@ gtk_css_image_win32_snapshot (GtkCssImage *image, cairo_t *cr; cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "Fallback<%s>", G_OBJECT_TYPE_NAME (image)); + &GRAPHENE_RECT_INIT (0, 0, width, height)); surface = gtk_win32_theme_create_surface (wimage->theme, wimage->part, wimage->state, wimage->margins, width, height, &dx, &dy); diff --git a/gtk/gtkcssshadowsvalue.c b/gtk/gtkcssshadowsvalue.c index d31bb66c7a..729b879991 100644 --- a/gtk/gtkcssshadowsvalue.c +++ b/gtk/gtkcssshadowsvalue.c @@ -417,7 +417,7 @@ gtk_css_shadows_value_push_snapshot (const GtkCssValue *value, { GskShadow *shadows = g_newa (GskShadow, value->len); gtk_css_shadows_value_get_shadows (value, shadows); - gtk_snapshot_push_shadow (snapshot, shadows, value->len, "Shadow<%u>", value->len); + gtk_snapshot_push_shadow (snapshot, shadows, value->len); } return need_shadow; diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c index f1198fff29..62e0db7340 100644 --- a/gtk/gtkcssshadowvalue.c +++ b/gtk/gtkcssshadowvalue.c @@ -1055,8 +1055,6 @@ gtk_css_shadow_value_snapshot_outset (const GtkCssValue *shadow, _gtk_css_number_value_get (shadow->voffset, 0), _gtk_css_number_value_get (shadow->spread, 0), _gtk_css_number_value_get (shadow->radius, 0)); - if (gtk_snapshot_get_record_names (snapshot)) - gsk_render_node_set_name (node, "Outset Shadow"); gtk_snapshot_append_node_internal (snapshot, node); gsk_render_node_unref (node); } @@ -1086,8 +1084,6 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue *shadow, _gtk_css_number_value_get (shadow->voffset, 0), _gtk_css_number_value_get (shadow->spread, 0), _gtk_css_number_value_get (shadow->radius, 0)); - if (gtk_snapshot_get_record_names (snapshot)) - gsk_render_node_set_name (node, "Inset Shadow"); gtk_snapshot_append_node_internal (snapshot, node); gsk_render_node_unref (node); } diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index 977e48e019..8abc7511c6 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -250,8 +250,7 @@ gtk_drawing_area_snapshot (GtkWidget *widget, &GRAPHENE_RECT_INIT ( 0, 0, width, height - ), - "DrawingAreaContents"); + )); priv->draw_func (self, cr, width, height, diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 6afd90e7b1..1419cca037 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3321,8 +3321,7 @@ gtk_entry_snapshot (GtkWidget *widget, priv->text_x, 0, priv->text_width, - gtk_widget_get_height (widget)), - "Entry Clip"); + gtk_widget_get_height (widget))); /* Draw text and cursor */ if (priv->dnd_position != -1) @@ -5700,7 +5699,7 @@ gtk_entry_draw_text (GtkEntry *entry, clip = gdk_pango_layout_get_clip_region (layout, x, y, range, 1); cairo_region_get_extents (clip, &clip_extents); - gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_extents), "Selected Text"); + gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_extents)); gtk_snapshot_render_background (snapshot, context, 0, 0, width, height); gtk_snapshot_render_layout (snapshot, context, x, y, layout); gtk_snapshot_pop (snapshot); @@ -5763,7 +5762,7 @@ gtk_entry_draw_cursor (GtkEntry *entry, gtk_style_context_save_to_node (context, priv->block_cursor_node); - gtk_snapshot_push_clip (snapshot, &bounds, "Block Cursor"); + gtk_snapshot_push_clip (snapshot, &bounds); gtk_snapshot_render_background (snapshot, context, 0, 0, width, height); gtk_snapshot_render_layout (snapshot, context, x, y, layout); gtk_snapshot_pop (snapshot); diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index 879791bc8f..a37159d32f 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -2348,8 +2348,7 @@ gtk_flow_box_snapshot (GtkWidget *widget, vertical = priv->orientation == GTK_ORIENTATION_VERTICAL; cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT (x, y, width, height), - "FlowBox Rubberband"); + &GRAPHENE_RECT_INIT (x, y, width, height)); context = gtk_widget_get_style_context (widget); gtk_style_context_save_to_node (context, priv->rubberband_node); diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c index b02ed709dd..6f98415d47 100644 --- a/gtk/gtkglarea.c +++ b/gtk/gtkglarea.c @@ -744,8 +744,7 @@ gtk_gl_area_snapshot (GtkWidget *widget, texture->holder, &GRAPHENE_RECT_INIT (0, 0, gtk_widget_get_width (widget), - gtk_widget_get_height (widget)), - "GL Area"); + gtk_widget_get_height (widget))); g_object_unref (texture->holder); } diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 012da29f45..ff7ca21cd6 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -1665,8 +1665,7 @@ gtk_icon_view_snapshot (GtkWidget *widget, &GRAPHENE_RECT_INIT ( 0, 0, width, height - ), - "IconView Clip"); + )); gtk_snapshot_offset (snapshot, - gtk_adjustment_get_value (icon_view->priv->hadjustment), @@ -6699,7 +6698,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view, if (index == item->index) { - snapshot = gtk_snapshot_new (FALSE, "IconView DragIcon"); + snapshot = gtk_snapshot_new (); gtk_icon_view_snapshot_item (icon_view, snapshot, item, icon_view->priv->item_padding, icon_view->priv->item_padding, diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index b4f85bc674..570d1ed3cd 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -3870,7 +3870,7 @@ gtk_label_snapshot (GtkWidget *widget, { cairo_region_get_rectangle (range_clip, i, &clip_rect); - gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect), "Selected Text"); + gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect)); gtk_snapshot_render_background (snapshot, context, x, 0, width, height); gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout); gtk_snapshot_pop (snapshot); @@ -3918,7 +3918,7 @@ gtk_label_snapshot (GtkWidget *widget, { cairo_region_get_rectangle (range_clip, i, &clip_rect); - gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect), "Active Link"); + gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect)); gtk_snapshot_render_background (snapshot, context, x, 0, width, height); gtk_snapshot_render_layout (snapshot, context, lx, ly, priv->layout); gtk_snapshot_pop (snapshot); diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c index 40eb6eb881..fce0f0399b 100644 --- a/gtk/gtkmagnifier.c +++ b/gtk/gtkmagnifier.c @@ -117,8 +117,7 @@ gtk_magnifier_snapshot (GtkWidget *widget, return; gtk_snapshot_push_clip (snapshot, - &GRAPHENE_RECT_INIT (0, 0, width, height), - "MagnifierClip"); + &GRAPHENE_RECT_INIT (0, 0, width, height)); graphene_matrix_init_translate (&transform, &GRAPHENE_POINT3D_INIT ( - CLAMP (priv->x, 0, paintable_width), @@ -130,7 +129,7 @@ gtk_magnifier_snapshot (GtkWidget *widget, if (!priv->resize) graphene_matrix_translate (&transform, &GRAPHENE_POINT3D_INIT (width / 2, height / 2, 0)); - gtk_snapshot_push_transform (snapshot, &transform, "Magnifier transform"); + gtk_snapshot_push_transform (snapshot, &transform); gdk_paintable_snapshot (priv->paintable, snapshot, paintable_width, paintable_height); gtk_snapshot_pop (snapshot); diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 1978f49b44..249cbd2e41 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -2743,8 +2743,7 @@ gtk_menu_snapshot (GtkWidget *widget, &GRAPHENE_RECT_INIT( 0, 0, gtk_widget_get_width (widget), - gtk_widget_get_height (widget)), - "MenuClip"); + gtk_widget_get_height (widget))); GTK_WIDGET_CLASS (gtk_menu_parent_class)->snapshot (widget, snapshot); diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c index a7fb220469..785865730d 100644 --- a/gtk/gtkoverlay.c +++ b/gtk/gtkoverlay.c @@ -672,8 +672,7 @@ gtk_overlay_snapshot (GtkWidget *widget, { GtkSnapshot *child_snapshot; - child_snapshot = gtk_snapshot_new (gtk_snapshot_get_record_names (snapshot), - "OverlayCaptureMainChild"); + child_snapshot = gtk_snapshot_new (); gtk_snapshot_offset (child_snapshot, main_alloc.x, main_alloc.y); gtk_widget_snapshot (main_widget, child_snapshot); gtk_snapshot_offset (child_snapshot, -main_alloc.x, -main_alloc.y); @@ -682,8 +681,8 @@ gtk_overlay_snapshot (GtkWidget *widget, gtk_widget_get_allocation (child, &alloc); graphene_rect_init (&bounds, alloc.x, alloc.y, alloc.width, alloc.height); - gtk_snapshot_push_clip (snapshot, &bounds, "Overlay Effect Clip"); - gtk_snapshot_push_blur (snapshot, blur, "Overlay Effect"); + gtk_snapshot_push_clip (snapshot, &bounds); + gtk_snapshot_push_blur (snapshot, blur); gtk_snapshot_append_node (snapshot, main_widget_node); gtk_snapshot_pop (snapshot); gtk_snapshot_pop (snapshot); @@ -714,7 +713,7 @@ gtk_overlay_snapshot (GtkWidget *widget, cairo_region_get_rectangle (clip, i, &rect); graphene_rect_init (&bounds, rect.x, rect.y, rect.width, rect.height); - gtk_snapshot_push_clip (snapshot, &bounds, "Overlay Non-Effect Clip"); + gtk_snapshot_push_clip (snapshot, &bounds); gtk_snapshot_append_node (snapshot, main_widget_node); gtk_snapshot_pop (snapshot); } diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 2331e94412..14f050572c 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -1404,8 +1404,7 @@ gtk_paned_snapshot (GtkWidget *widget, 0, 0, gtk_widget_get_width (widget), gtk_widget_get_height (widget) - ), - "GtkPaned"); + )); if (priv->child1 && gtk_widget_get_visible (priv->child1) && priv->child2 && gtk_widget_get_visible (priv->child2)) diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 1ec918f299..cec113c71d 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -1216,8 +1216,7 @@ gtk_popover_snapshot (GtkWidget *widget, 0, 0, gtk_widget_get_width (widget), gtk_widget_get_height (widget) - ), - "Popover"); + )); /* Clip to the arrow shape */ cairo_save (cr); diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c index 7957f97b20..e4143fedd8 100644 --- a/gtk/gtkrenderbackground.c +++ b/gtk/gtkrenderbackground.c @@ -90,18 +90,15 @@ gtk_theming_background_snapshot_color (const GtkThemingBackground *bg, { gtk_snapshot_append_color (snapshot, bg_color, - &bg->boxes[clip].bounds, - "BackgroundColor"); + &bg->boxes[clip].bounds); } else { gtk_snapshot_push_rounded_clip (snapshot, - &bg->boxes[clip], - "BackgroundColorClip"); + &bg->boxes[clip]); gtk_snapshot_append_color (snapshot, bg_color, - &bg->boxes[clip].bounds, - "BackgroundColor"); + &bg->boxes[clip].bounds); gtk_snapshot_pop (snapshot); } } @@ -390,7 +387,8 @@ gtk_theming_background_snapshot_layer (const GtkThemingBackground *bg, if (image_height == height) vrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT; - gtk_snapshot_push_rounded_clip (snapshot, clip, "BackgroundLayerClip<%u>", idx); + gtk_snapshot_push_debug (snapshot, "Layer %u", idx); + gtk_snapshot_push_rounded_clip (snapshot, clip); gtk_snapshot_offset (snapshot, origin->bounds.origin.x, origin->bounds.origin.y); @@ -501,8 +499,7 @@ gtk_theming_background_snapshot_layer (const GtkThemingBackground *bg, &GRAPHENE_RECT_INIT ( position_x, position_y, repeat_width, repeat_height - ), - "BackgroundLayerRepeat<%u>", idx); + )); gtk_snapshot_offset (snapshot, position_x + 0.5 * (repeat_width - image_width), @@ -515,6 +512,7 @@ gtk_theming_background_snapshot_layer (const GtkThemingBackground *bg, gtk_snapshot_offset (snapshot, - origin->bounds.origin.x, - origin->bounds.origin.y); gtk_snapshot_pop (snapshot); + gtk_snapshot_pop (snapshot); } static void @@ -640,6 +638,8 @@ gtk_css_style_snapshot_background (GtkCssStyle *style, gtk_theming_background_init (&bg, style, width, height); + gtk_snapshot_push_debug (snapshot, "CSS background"); + gtk_css_shadows_value_snapshot_outset (box_shadow, snapshot, &bg.boxes[GTK_CSS_AREA_BORDER_BOX]); @@ -653,8 +653,7 @@ gtk_css_style_snapshot_background (GtkCssStyle *style, blend_mode_values[idx] = _gtk_css_blend_mode_value_get (_gtk_css_array_value_get_nth (blend_modes, idx)); if (blend_mode_values[idx] != GSK_BLEND_MODE_DEFAULT) - gtk_snapshot_push_blend (snapshot, blend_mode_values[idx], "Background<%u>Blend<%u>", - idx, blend_mode_values[idx]); + gtk_snapshot_push_blend (snapshot, blend_mode_values[idx]); } if (!gdk_rgba_is_clear (bg_color)) @@ -677,5 +676,7 @@ gtk_css_style_snapshot_background (GtkCssStyle *style, gtk_css_shadows_value_snapshot_inset (box_shadow, snapshot, &bg.boxes[GTK_CSS_AREA_PADDING_BOX]); + + gtk_snapshot_pop (snapshot); } diff --git a/gtk/gtkrenderborder.c b/gtk/gtkrenderborder.c index 540a66e2d8..be5993698a 100644 --- a/gtk/gtkrenderborder.c +++ b/gtk/gtkrenderborder.c @@ -439,8 +439,6 @@ snapshot_frame_fill (GtkSnapshot *snapshot, gsk_rounded_rect_offset (&offset_outline, off_x, off_y); node = gsk_border_node_new (&offset_outline, border_width, colors); - if (gtk_snapshot_get_record_names (snapshot)) - gsk_render_node_set_name (node, "Border"); gtk_snapshot_append_node_internal (snapshot, node); gsk_render_node_unref (node); } @@ -591,8 +589,7 @@ snapshot_frame_stroke (GtkSnapshot *snapshot, cairo_t *cr; cr = gtk_snapshot_append_cairo (snapshot, - &outline->bounds, - "BorderStroke"); + &outline->bounds); render_frame_stroke (cr, outline, double_width, colors, hidden_side, stroke_style); cairo_destroy (cr); } @@ -942,11 +939,12 @@ gtk_css_style_snapshot_border (GtkCssStyle *style, { double double_width[4] = { border_width[0], border_width[1], border_width[2], border_width[3] }; + gtk_snapshot_push_debug (snapshot, "CSS border image"); cr = gtk_snapshot_append_cairo (snapshot, - &bounds, - "Border Image"); + &bounds); gtk_border_image_render (&border_image, double_width, cr, 0, 0, width, height); cairo_destroy (cr); + gtk_snapshot_pop (snapshot); } else { @@ -978,7 +976,9 @@ gtk_css_style_snapshot_border (GtkCssStyle *style, gtk_rounded_boxes_init_for_style (&border_box, NULL, NULL, style, 0, 0, width, height); + gtk_snapshot_push_debug (snapshot, "CSS border"); snapshot_border (snapshot, &border_box, border_width, colors, border_style); + gtk_snapshot_pop (snapshot); } } diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c index 0060cb6710..3ebb941008 100644 --- a/gtk/gtkrendericon.c +++ b/gtk/gtkrendericon.c @@ -119,6 +119,8 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, if (!gtk_css_transform_value_get_matrix (transform_value, &transform_matrix)) return; + gtk_snapshot_push_debug (snapshot, "CSS Icon @ %gx%g", width, height); + gtk_css_filter_value_push_snapshot (filter_value, snapshot); has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot); @@ -137,7 +139,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT (- width / 2.0, - height / 2.0, 0)); graphene_matrix_multiply (&m2, &m3, &m1); - gtk_snapshot_push_transform (snapshot, &m1, "CSS Icon Transform Container"); + gtk_snapshot_push_transform (snapshot, &m1); gtk_css_image_builtin_snapshot (image, snapshot, width, height, builtin_type); @@ -148,6 +150,8 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, gtk_snapshot_pop (snapshot); gtk_css_filter_value_pop_snapshot (filter_value, snapshot); + + gtk_snapshot_pop (snapshot); } static gboolean @@ -309,7 +313,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, }); graphene_vec4_init (&color_offset, fg.red, fg.green, fg.blue, 0); - gtk_snapshot_push_color_matrix (snapshot, &color_matrix, &color_offset, "Recoloring Icon"); + gtk_snapshot_push_color_matrix (snapshot, &color_matrix, &color_offset); } if (graphene_matrix_is_identity (&transform_matrix)) @@ -326,7 +330,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT (- width / 2.0, - height / 2.0, 0)); graphene_matrix_multiply (&m2, &m3, &m1); - gtk_snapshot_push_transform (snapshot, &m1, "Icon Transform"); + gtk_snapshot_push_transform (snapshot, &m1); gdk_paintable_snapshot (paintable, snapshot, width, height); diff --git a/gtk/gtkrendernodepaintable.c b/gtk/gtkrendernodepaintable.c index 5ec8160946..0ca586d820 100644 --- a/gtk/gtkrendernodepaintable.c +++ b/gtk/gtkrendernodepaintable.c @@ -57,11 +57,10 @@ gtk_render_node_paintable_paintable_snapshot (GdkPaintable *paintable, height / (self->bounds.size.height), 1.0); gtk_snapshot_push_transform (snapshot, - &transform, - "RenderNodeScaleToFit"); + &transform); } - gtk_snapshot_push_clip (snapshot, &self->bounds, "RenderNodePaintableClip"); + gtk_snapshot_push_clip (snapshot, &self->bounds); gtk_snapshot_offset (snapshot, self->bounds.origin.x, self->bounds.origin.y); gtk_snapshot_append_node (snapshot, self->node); diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c index c8d00190b4..49aa81458e 100644 --- a/gtk/gtkrevealer.c +++ b/gtk/gtkrevealer.c @@ -637,8 +637,7 @@ gtk_revealer_snapshot (GtkWidget *widget, 0, 0, gtk_widget_get_width (widget), gtk_widget_get_height (widget) - ), - "RevealerClip"); + )); gtk_widget_snapshot_child (widget, child, snapshot); gtk_snapshot_pop (snapshot); } diff --git a/gtk/gtkscaler.c b/gtk/gtkscaler.c index 2d9caa718f..266e4dc74a 100644 --- a/gtk/gtkscaler.c +++ b/gtk/gtkscaler.c @@ -53,10 +53,7 @@ gtk_scaler_paintable_snapshot (GdkPaintable *paintable, graphene_matrix_t scale_matrix; graphene_matrix_init_scale (&scale_matrix, 1.0 / self->scale_factor, 1.0 / self->scale_factor, 1.0); - gtk_snapshot_push_transform (snapshot, - &scale_matrix, - "GtkScaler<%g>", - self->scale_factor); + gtk_snapshot_push_transform (snapshot, &scale_matrix); gdk_paintable_snapshot (self->paintable, snapshot, width * self->scale_factor, diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index 712c7cb7e3..3b175505dd 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -85,8 +85,7 @@ static GskRenderNode * gtk_snapshot_collect_default (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *node; @@ -101,8 +100,6 @@ gtk_snapshot_collect_default (GtkSnapshot *snapshot, else { node = gsk_container_node_new (nodes, n_nodes); - if (name) - gsk_render_node_set_name (node, name); } return node; @@ -110,14 +107,12 @@ gtk_snapshot_collect_default (GtkSnapshot *snapshot, static GtkSnapshotState * gtk_snapshot_push_state (GtkSnapshot *snapshot, - char *name, int translate_x, int translate_y, GtkSnapshotCollectFunc collect_func) { GtkSnapshotState state = { 0, }; - state.name = name; state.translate_x = translate_x; state.translate_y = translate_y; state.collect_func = collect_func; @@ -148,83 +143,30 @@ gtk_snapshot_get_previous_state (const GtkSnapshot *snapshot) static void gtk_snapshot_state_clear (GtkSnapshotState *state) { - g_clear_pointer (&state->name, g_free); -} - -static GtkSnapshot * -gtk_snapshot_new_internal (gboolean record_names, - char *name) -{ - GtkSnapshot *snapshot; - - snapshot = g_object_new (GTK_TYPE_SNAPSHOT, NULL); - - snapshot->record_names = record_names; - 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, - 0, 0, - gtk_snapshot_collect_default); - - return snapshot; } /** * gtk_snapshot_new: - * @record_names: whether to keep node names (for debugging purposes) - * @name: a printf-style format string to create the node name - * @...: arguments for @name * * Creates a new #GtkSnapshot. * * Returns: a newly-allocated #GtkSnapshot */ GtkSnapshot * -gtk_snapshot_new (gboolean record_names, - 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; - - return gtk_snapshot_new_internal (record_names, - str); -} - -GtkSnapshot * -gtk_snapshot_new_child (GtkSnapshot *parent, - const char *name, - ...) +gtk_snapshot_new (void) { GtkSnapshot *snapshot; - char *str; - if (name && parent->record_names) - { - va_list args; + snapshot = g_object_new (GTK_TYPE_SNAPSHOT, NULL); - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; + snapshot->record_names = FALSE; + 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); - snapshot = gtk_snapshot_new_internal (parent->record_names, - str); + gtk_snapshot_push_state (snapshot, + 0, 0, + gtk_snapshot_collect_default); return snapshot; } @@ -272,72 +214,68 @@ gtk_snapshot_free_to_paintable (GtkSnapshot *snapshot, return result; } -/** - * gtk_snapshot_push: - * @snapshot: a #GtkSnapshot - * @keep_coordinates: If %TRUE, the current offset will be kept. - * Otherwise, the offset will be reset to (0, 0). - * @name: (transfer none): a printf() style format string for the name for the new node - * @...: arguments to insert into the format string - * - * Creates a new render node, appends it to the current render - * node of @snapshot, and makes it the new current render node. - */ +static GskRenderNode * +gtk_snapshot_collect_debug (GtkSnapshot *snapshot, + GtkSnapshotState *state, + GskRenderNode **nodes, + guint n_nodes) +{ + GskRenderNode *node, *debug_node; + + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); + if (node == NULL) + return NULL; + + if (state->data.debug.message == NULL) + return node; + + debug_node = gsk_debug_node_new (node, state->data.debug.message); + + gsk_render_node_unref (node); + + return debug_node; +} + void -gtk_snapshot_push (GtkSnapshot *snapshot, - gboolean keep_coordinates, - const char *name, - ...) +gtk_snapshot_push_debug (GtkSnapshot *snapshot, + const char *message, + ...) { - char *str; + GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); + GtkSnapshotState *state; - if (name && snapshot->record_names) + state = gtk_snapshot_push_state (snapshot, + current_state->translate_x, + current_state->translate_y, + gtk_snapshot_collect_debug); + + if (snapshot->record_names) { va_list args; - va_start (args, name); - str = g_strdup_vprintf (name, args); + va_start (args, message); + state->data.debug.message = g_strdup_vprintf (message, args); va_end (args); } else - str = NULL; - - if (keep_coordinates) - { - GtkSnapshotState *state = gtk_snapshot_get_current_state (snapshot); - - gtk_snapshot_push_state (snapshot, - g_strdup (str), - state->translate_x, - state->translate_y, - gtk_snapshot_collect_default); - - } - else { - gtk_snapshot_push_state (snapshot, - g_strdup (str), - 0, 0, - gtk_snapshot_collect_default); + state->data.debug.message = NULL; } } static GskRenderNode * gtk_snapshot_collect_transform (GtkSnapshot *snapshot, GtkSnapshotState *state, - GskRenderNode **nodes, - guint n_nodes, - const char *name) + GskRenderNode **nodes, + guint n_nodes) { GskRenderNode *node, *transform_node; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; transform_node = gsk_transform_node_new (node, &state->data.transform.transform); - if (name) - gsk_render_node_set_name (transform_node, name); gsk_render_node_unref (node); @@ -346,28 +284,13 @@ gtk_snapshot_collect_transform (GtkSnapshot *snapshot, void gtk_snapshot_push_transform (GtkSnapshot *snapshot, - const graphene_matrix_t *transform, - const char *name, - ...) + const graphene_matrix_t *transform) { GtkSnapshotState *previous_state; GtkSnapshotState *state; graphene_matrix_t offset; - char *str; - - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; state = gtk_snapshot_push_state (snapshot, - str, 0, 0, gtk_snapshot_collect_transform); @@ -387,13 +310,12 @@ static GskRenderNode * gtk_snapshot_collect_offset (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *node, *offset_node; GtkSnapshotState *previous_state; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; @@ -418,9 +340,6 @@ gtk_snapshot_collect_offset (GtkSnapshot *snapshot, previous_state->translate_y); } - if (name) - gsk_render_node_set_name (offset_node, name); - gsk_render_node_unref (node); return offset_node; @@ -429,32 +348,20 @@ gtk_snapshot_collect_offset (GtkSnapshot *snapshot, static void gtk_snapshot_push_offset (GtkSnapshot *snapshot) { - GtkSnapshotState *state = gtk_snapshot_get_current_state (snapshot); - char *str; - - if (snapshot->record_names) - { - str = g_strdup_printf ("Offset<%d,%d>", state->translate_x, state->translate_y); - } - else - str = NULL; - - state = gtk_snapshot_push_state (snapshot, - str, - 0, 0, - gtk_snapshot_collect_offset); + gtk_snapshot_push_state (snapshot, + 0, 0, + gtk_snapshot_collect_offset); } static GskRenderNode * gtk_snapshot_collect_opacity (GtkSnapshot *snapshot, GtkSnapshotState *state, - GskRenderNode **nodes, - guint n_nodes, - const char *name) + GskRenderNode **nodes, + guint n_nodes) { GskRenderNode *node, *opacity_node; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; @@ -470,8 +377,6 @@ gtk_snapshot_collect_opacity (GtkSnapshot *snapshot, else { opacity_node = gsk_opacity_node_new (node, state->data.opacity.opacity); - if (name) - gsk_render_node_set_name (opacity_node, name); gsk_render_node_unref (node); } @@ -480,27 +385,12 @@ gtk_snapshot_collect_opacity (GtkSnapshot *snapshot, void gtk_snapshot_push_opacity (GtkSnapshot *snapshot, - double opacity, - const char *name, - ...) + double opacity) { GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *state; - char *str; - - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_opacity); @@ -510,14 +400,13 @@ gtk_snapshot_push_opacity (GtkSnapshot *snapshot, static GskRenderNode * gtk_snapshot_collect_blur (GtkSnapshot *snapshot, GtkSnapshotState *state, - GskRenderNode **nodes, - guint n_nodes, - const char *name) + GskRenderNode **nodes, + guint n_nodes) { GskRenderNode *node, *blur_node; double radius; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; @@ -527,8 +416,6 @@ gtk_snapshot_collect_blur (GtkSnapshot *snapshot, return node; blur_node = gsk_blur_node_new (node, radius); - if (name) - gsk_render_node_set_name (blur_node, name); gsk_render_node_unref (node); @@ -537,44 +424,27 @@ gtk_snapshot_collect_blur (GtkSnapshot *snapshot, void gtk_snapshot_push_blur (GtkSnapshot *snapshot, - double radius, - const char *name, - ...) + double radius) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *state; - char *str; - - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_blur); state->data.blur.radius = radius; - current_state = state; } static GskRenderNode * gtk_snapshot_collect_color_matrix (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *node, *color_matrix_node; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; @@ -614,43 +484,24 @@ gtk_snapshot_collect_color_matrix (GtkSnapshot *snapshot, gsk_render_node_unref (node); } - if (name) - gsk_render_node_set_name (color_matrix_node, name); - return color_matrix_node; } void gtk_snapshot_push_color_matrix (GtkSnapshot *snapshot, const graphene_matrix_t *color_matrix, - const graphene_vec4_t *color_offset, - const char *name, - ...) + const graphene_vec4_t *color_offset) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *state; - char *str; - - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_color_matrix); graphene_matrix_init_from_matrix (&state->data.color_matrix.matrix, color_matrix); graphene_vec4_init_from_vec4 (&state->data.color_matrix.offset, color_offset); - current_state = state; } static void @@ -667,22 +518,19 @@ static GskRenderNode * gtk_snapshot_collect_repeat (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *node, *repeat_node; graphene_rect_t *bounds = &state->data.repeat.bounds; graphene_rect_t *child_bounds = &state->data.repeat.child_bounds; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; repeat_node = gsk_repeat_node_new (bounds, node, child_bounds->size.width > 0 ? child_bounds : NULL); - if (name) - gsk_render_node_set_name (repeat_node, name); gsk_render_node_unref (node); @@ -692,31 +540,16 @@ gtk_snapshot_collect_repeat (GtkSnapshot *snapshot, void gtk_snapshot_push_repeat (GtkSnapshot *snapshot, const graphene_rect_t *bounds, - const graphene_rect_t *child_bounds, - const char *name, - ...) + const graphene_rect_t *child_bounds) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *state; graphene_rect_t real_child_bounds = { { 0 } }; - char *str; - - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; if (child_bounds) graphene_rect_offset_r (child_bounds, current_state->translate_x, current_state->translate_y, &real_child_bounds); state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_repeat); @@ -725,20 +558,17 @@ gtk_snapshot_push_repeat (GtkSnapshot *snapshot, graphene_rect_offset_r (bounds, current_state->translate_x, current_state->translate_y, &state->data.repeat.bounds); state->data.repeat.child_bounds = real_child_bounds; - - current_state = state; } static GskRenderNode * gtk_snapshot_collect_clip (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *node, *clip_node; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; @@ -751,8 +581,6 @@ gtk_snapshot_collect_clip (GtkSnapshot *snapshot, return NULL; clip_node = gsk_clip_node_new (node, &state->data.clip.bounds); - if (name) - gsk_render_node_set_name (clip_node, name); gsk_render_node_unref (node); @@ -761,33 +589,18 @@ gtk_snapshot_collect_clip (GtkSnapshot *snapshot, void gtk_snapshot_push_clip (GtkSnapshot *snapshot, - const graphene_rect_t *bounds, - const char *name, - ...) + const graphene_rect_t *bounds) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *state; graphene_rect_t real_bounds; cairo_rectangle_int_t rect; - char *str; graphene_rect_offset_r (bounds, current_state->translate_x, current_state->translate_y, &real_bounds); - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; - rectangle_init_from_graphene (&rect, &real_bounds); state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_clip); @@ -799,12 +612,11 @@ static GskRenderNode * gtk_snapshot_collect_rounded_clip (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *node, *clip_node; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; @@ -833,9 +645,6 @@ gtk_snapshot_collect_rounded_clip (GtkSnapshot *snapshot, return NULL; } - if (name) - gsk_render_node_set_name (clip_node, name); - gsk_render_node_unref (node); return clip_node; @@ -843,36 +652,20 @@ gtk_snapshot_collect_rounded_clip (GtkSnapshot *snapshot, void gtk_snapshot_push_rounded_clip (GtkSnapshot *snapshot, - const GskRoundedRect *bounds, - const char *name, - ...) + const GskRoundedRect *bounds) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *state; GskRoundedRect real_bounds; - char *str; gsk_rounded_rect_init_copy (&real_bounds, bounds); gsk_rounded_rect_offset (&real_bounds, current_state->translate_x, current_state->translate_y); - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; - state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_rounded_clip); - state->data.rounded_clip.bounds = real_bounds; } @@ -880,12 +673,11 @@ static GskRenderNode * gtk_snapshot_collect_shadow (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *node, *shadow_node; - node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); if (node == NULL) return NULL; @@ -894,8 +686,6 @@ gtk_snapshot_collect_shadow (GtkSnapshot *snapshot, state->data.shadow.shadows : &state->data.shadow.a_shadow, state->data.shadow.n_shadows); - if (name) - gsk_render_node_set_name (shadow_node, name); gsk_render_node_unref (node); g_free (state->data.shadow.shadows); @@ -904,29 +694,14 @@ gtk_snapshot_collect_shadow (GtkSnapshot *snapshot, } void -gtk_snapshot_push_shadow (GtkSnapshot *snapshot, - const GskShadow *shadow, - gsize n_shadows, - const char *name, - ...) +gtk_snapshot_push_shadow (GtkSnapshot *snapshot, + const GskShadow *shadow, + gsize n_shadows) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *state; - char *str; - - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_shadow); @@ -949,13 +724,12 @@ static GskRenderNode * gtk_snapshot_collect_blend_top (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *bottom_node, *top_node, *blend_node; GdkRGBA transparent = { 0, 0, 0, 0 }; - top_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + top_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); bottom_node = state->data.blend.bottom_node; g_assert (top_node != NULL || bottom_node != NULL); @@ -967,7 +741,6 @@ gtk_snapshot_collect_blend_top (GtkSnapshot *snapshot, bottom_node = gsk_color_node_new (&transparent, &top_node->bounds); blend_node = gsk_blend_node_new (bottom_node, top_node, state->data.blend.blend_mode); - gsk_render_node_set_name (blend_node, name); gsk_render_node_unref (top_node); gsk_render_node_unref (bottom_node); @@ -979,14 +752,13 @@ static GskRenderNode * gtk_snapshot_collect_blend_bottom (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GtkSnapshotState *prev_state = gtk_snapshot_get_previous_state (snapshot); g_assert (prev_state->collect_func == gtk_snapshot_collect_blend_top); - prev_state->data.blend.bottom_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + prev_state->data.blend.bottom_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); return NULL; } @@ -995,8 +767,6 @@ gtk_snapshot_collect_blend_bottom (GtkSnapshot *snapshot, * gtk_snapshot_push_blend: * @snapshot: a #GtkSnapshot * @blend_mode: blend mode to use - * @name: printf format string for name of the pushed node - * @...: printf-style arguments for the @name string * * Blends together 2 images with the given blend mode. * @@ -1008,34 +778,18 @@ gtk_snapshot_collect_blend_bottom (GtkSnapshot *snapshot, **/ void gtk_snapshot_push_blend (GtkSnapshot *snapshot, - GskBlendMode blend_mode, - const char *name, - ...) + GskBlendMode blend_mode) { GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *top_state; - char *str; - - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; top_state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_blend_top); top_state->data.blend.blend_mode = blend_mode; gtk_snapshot_push_state (snapshot, - g_strdup (str), top_state->translate_x, top_state->translate_y, gtk_snapshot_collect_blend_bottom); @@ -1045,12 +799,11 @@ static GskRenderNode * gtk_snapshot_collect_cross_fade_end (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GskRenderNode *start_node, *end_node, *node; - end_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + end_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); start_node = state->data.cross_fade.start_node; if (state->data.cross_fade.progress <= 0.0) @@ -1070,7 +823,6 @@ gtk_snapshot_collect_cross_fade_end (GtkSnapshot *snapshot, else if (start_node && end_node) { node = gsk_cross_fade_node_new (start_node, end_node, state->data.cross_fade.progress); - gsk_render_node_set_name (node, name); gsk_render_node_unref (start_node); gsk_render_node_unref (end_node); @@ -1078,14 +830,12 @@ gtk_snapshot_collect_cross_fade_end (GtkSnapshot *snapshot, else if (start_node) { node = gsk_opacity_node_new (start_node, 1.0 - state->data.cross_fade.progress); - gsk_render_node_set_name (node, name); gsk_render_node_unref (start_node); } else if (end_node) { node = gsk_opacity_node_new (end_node, state->data.cross_fade.progress); - gsk_render_node_set_name (node, name); gsk_render_node_unref (end_node); } @@ -1101,14 +851,13 @@ static GskRenderNode * gtk_snapshot_collect_cross_fade_start (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name) + guint n_nodes) { GtkSnapshotState *prev_state = gtk_snapshot_get_previous_state (snapshot); g_assert (prev_state->collect_func == gtk_snapshot_collect_cross_fade_end); - prev_state->data.cross_fade.start_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes, name); + prev_state->data.cross_fade.start_node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes); return NULL; } @@ -1117,8 +866,6 @@ gtk_snapshot_collect_cross_fade_start (GtkSnapshot *snapshot, * gtk_snapshot_push_cross_fade: * @snapshot: a #GtkSnapshot * @progress: progress between 0.0 and 1.0 - * @name: printf format string for name of the pushed node - * @...: printf-style arguments for the @name string * * Snapshots a cross-fade operation between two images with the * given @progress. @@ -1131,34 +878,18 @@ gtk_snapshot_collect_cross_fade_start (GtkSnapshot *snapshot, **/ void gtk_snapshot_push_cross_fade (GtkSnapshot *snapshot, - double progress, - const char *name, - ...) + double progress) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GtkSnapshotState *end_state; - char *str; - - if (name && snapshot->record_names) - { - va_list args; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - } - else - str = NULL; end_state = gtk_snapshot_push_state (snapshot, - str, current_state->translate_x, current_state->translate_y, gtk_snapshot_collect_cross_fade_end); end_state->data.cross_fade.progress = progress; gtk_snapshot_push_state (snapshot, - g_strdup (str), end_state->translate_x, end_state->translate_y, gtk_snapshot_collect_cross_fade_start); @@ -1183,8 +914,7 @@ gtk_snapshot_pop_internal (GtkSnapshot *snapshot) node = state->collect_func (snapshot, state, (GskRenderNode **) snapshot->nodes->pdata + state->start_node_index, - state->n_nodes, - state->name); + state->n_nodes); /* The collect func may not modify the state stack... */ g_assert (state_index == snapshot->state_stack->len - 1); @@ -1220,15 +950,7 @@ gtk_snapshot_to_node (GtkSnapshot *snapshot) /* We should have exactly our initial state */ if (snapshot->state_stack->len > 1) { - gint i; - - g_warning ("Too many gtk_snapshot_push() calls. Still there:"); - for (i = snapshot->state_stack->len - 1; i >= 0; i --) - { - const GtkSnapshotState *s = &g_array_index (snapshot->state_stack, GtkSnapshotState, i); - - g_warning ("%s", s->name); - } + g_warning ("Too many gtk_snapshot_push() calls. %u states remaining.", snapshot->state_stack->len); } result = gtk_snapshot_pop_internal (snapshot); @@ -1295,21 +1017,6 @@ gtk_snapshot_pop (GtkSnapshot *snapshot) } /** - * gtk_snapshot_get_record_names: - * @snapshot: a #GtkSnapshot - * - * Obtains whether the snapshot is recording names - * for debugging. - * - * Returns: whether the snapshot records names - */ -gboolean -gtk_snapshot_get_record_names (GtkSnapshot *snapshot) -{ - return snapshot->record_names; -} - -/** * gtk_snapshot_offset: * @snapshot: a $GtkSnapshot * @x: horizontal translation @@ -1404,8 +1111,6 @@ gtk_snapshot_append_node (GtkSnapshot *snapshot, * gtk_snapshot_append_cairo: * @snapshot: a #GtkSnapshot * @bounds: the bounds for the new node - * @name: (transfer none): a printf() style format string for the name for the new node - * @...: arguments to insert into the format string * * Creates a new render node and appends it to the current render * node of @snapshot, without changing the current node. @@ -1415,9 +1120,7 @@ gtk_snapshot_append_node (GtkSnapshot *snapshot, */ cairo_t * gtk_snapshot_append_cairo (GtkSnapshot *snapshot, - const graphene_rect_t *bounds, - const char *name, - ...) + const graphene_rect_t *bounds) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GskRenderNode *node; @@ -1431,20 +1134,6 @@ gtk_snapshot_append_cairo (GtkSnapshot *snapshot, node = gsk_cairo_node_new (&real_bounds); - if (name && snapshot->record_names) - { - va_list args; - char *str; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - - gsk_render_node_set_name (node, str); - - g_free (str); - } - gtk_snapshot_append_node_internal (snapshot, node); gsk_render_node_unref (node); @@ -1460,18 +1149,14 @@ gtk_snapshot_append_cairo (GtkSnapshot *snapshot, * @snapshot: a #GtkSnapshot * @texture: the #GdkTexture to render * @bounds: the bounds for the new node - * @name: (transfer none): a printf() style format string for the name for the new node - * @...: arguments to insert into the format string * * Creates a new render node drawing the @texture into the given @bounds and appends it * to the current render node of @snapshot. **/ void -gtk_snapshot_append_texture (GtkSnapshot *snapshot, - GdkTexture *texture, - const graphene_rect_t *bounds, - const char *name, - ...) +gtk_snapshot_append_texture (GtkSnapshot *snapshot, + GdkTexture *texture, + const graphene_rect_t *bounds) { GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GskRenderNode *node; @@ -1484,20 +1169,6 @@ gtk_snapshot_append_texture (GtkSnapshot *snapshot, graphene_rect_offset_r (bounds, current_state->translate_x, current_state->translate_y, &real_bounds); node = gsk_texture_node_new (texture, &real_bounds); - if (name && snapshot->record_names) - { - va_list args; - char *str; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - - gsk_render_node_set_name (node, str); - - g_free (str); - } - gtk_snapshot_append_node_internal (snapshot, node); gsk_render_node_unref (node); } @@ -1507,8 +1178,6 @@ gtk_snapshot_append_texture (GtkSnapshot *snapshot, * @snapshot: a #GtkSnapshot * @color: the #GdkRGBA to draw * @bounds: the bounds for the new node - * @name: (transfer none): a printf() style format string for the name for the new node - * @...: arguments to insert into the format string * * Creates a new render node drawing the @color into the given @bounds and appends it * to the current render node of @snapshot. @@ -1518,9 +1187,7 @@ gtk_snapshot_append_texture (GtkSnapshot *snapshot, void gtk_snapshot_append_color (GtkSnapshot *snapshot, const GdkRGBA *color, - const graphene_rect_t *bounds, - const char *name, - ...) + const graphene_rect_t *bounds) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GskRenderNode *node; @@ -1535,20 +1202,6 @@ gtk_snapshot_append_color (GtkSnapshot *snapshot, node = gsk_color_node_new (color, &real_bounds); - if (name && snapshot->record_names) - { - va_list args; - char *str; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - - gsk_render_node_set_name (node, str); - - g_free (str); - } - gtk_snapshot_append_node_internal (snapshot, node); gsk_render_node_unref (node); } @@ -1680,7 +1333,7 @@ gtk_snapshot_render_layout (GtkSnapshot *snapshot, shadows_value = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_SHADOW); has_shadow = gtk_css_shadows_value_push_snapshot (shadows_value, snapshot); - gtk_snapshot_append_layout (snapshot, layout, fg_color, "RenderLayout"); + gtk_snapshot_append_layout (snapshot, layout, fg_color); if (has_shadow) gtk_snapshot_pop (snapshot); @@ -1705,9 +1358,7 @@ gtk_snapshot_append_linear_gradient (GtkSnapshot *snapshot, const graphene_point_t *start_point, const graphene_point_t *end_point, const GskColorStop *stops, - gsize n_stops, - const char *name, - ...) + gsize n_stops) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GskRenderNode *node; @@ -1733,20 +1384,6 @@ gtk_snapshot_append_linear_gradient (GtkSnapshot *snapshot, stops, n_stops); - if (name && snapshot->record_names) - { - va_list args; - char *str; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - - gsk_render_node_set_name (node, str); - - g_free (str); - } - gtk_snapshot_append_node_internal (snapshot, node); gsk_render_node_unref (node); } @@ -1768,9 +1405,7 @@ gtk_snapshot_append_repeating_linear_gradient (GtkSnapshot *snapshot, const graphene_point_t *start_point, const graphene_point_t *end_point, const GskColorStop *stops, - gsize n_stops, - const char *name, - ...) + gsize n_stops) { const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot); GskRenderNode *node; @@ -1796,20 +1431,6 @@ gtk_snapshot_append_repeating_linear_gradient (GtkSnapshot *snapshot, stops, n_stops); - if (name && snapshot->record_names) - { - va_list args; - char *str; - - va_start (args, name); - str = g_strdup_vprintf (name, args); - va_end (args); - - gsk_render_node_set_name (node, str); - - g_free (str); - } - gtk_snapshot_append_node_internal (snapshot, node); gsk_render_node_unref (node); } diff --git a/gtk/gtksnapshot.h b/gtk/gtksnapshot.h index 577994c1b6..97afd43663 100644 --- a/gtk/gtksnapshot.h +++ b/gtk/gtksnapshot.h @@ -52,9 +52,7 @@ GDK_AVAILABLE_IN_ALL GType gtk_snapshot_get_type (void) G_GNUC_CONST; GDK_AVAILABLE_IN_ALL -GtkSnapshot * gtk_snapshot_new (gboolean record_names, - const char *name, - ...) G_GNUC_PRINTF (2, 3); +GtkSnapshot * gtk_snapshot_new (void); GDK_AVAILABLE_IN_ALL GskRenderNode * gtk_snapshot_free_to_node (GtkSnapshot *snapshot); GDK_AVAILABLE_IN_ALL @@ -68,66 +66,42 @@ GdkPaintable * gtk_snapshot_to_paintable (GtkSnapshot const graphene_size_t *size); GDK_AVAILABLE_IN_ALL -gboolean gtk_snapshot_get_record_names (GtkSnapshot *snapshot); - -GDK_AVAILABLE_IN_ALL -void gtk_snapshot_push (GtkSnapshot *snapshot, - gboolean keep_coordinates, - const char *name, - ...) G_GNUC_PRINTF (3, 4); +void gtk_snapshot_push_debug (GtkSnapshot *snapshot, + const char *message, + ...) G_GNUC_PRINTF (2, 3); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_transform (GtkSnapshot *snapshot, - const graphene_matrix_t*transform, - const char *name, - ...) G_GNUC_PRINTF (3, 4); + const graphene_matrix_t*transform); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_opacity (GtkSnapshot *snapshot, - double opacity, - const char *name, - ...) G_GNUC_PRINTF (3, 4); + double opacity); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_blur (GtkSnapshot *snapshot, - double radius, - const char *name, - ...) G_GNUC_PRINTF (3, 4); + double radius); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_color_matrix (GtkSnapshot *snapshot, const graphene_matrix_t*color_matrix, - const graphene_vec4_t *color_offset, - const char *name, - ...) G_GNUC_PRINTF (4, 5); + const graphene_vec4_t *color_offset); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_repeat (GtkSnapshot *snapshot, const graphene_rect_t *bounds, - const graphene_rect_t *child_bounds, - const char *name, - ...) G_GNUC_PRINTF (4, 5); + const graphene_rect_t *child_bounds); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_clip (GtkSnapshot *snapshot, - const graphene_rect_t *bounds, - const char *name, - ...) G_GNUC_PRINTF (3, 4); + const graphene_rect_t *bounds); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_rounded_clip (GtkSnapshot *snapshot, - const GskRoundedRect *bounds, - const char *name, - ...) G_GNUC_PRINTF (3, 4); + const GskRoundedRect *bounds); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_shadow (GtkSnapshot *snapshot, const GskShadow *shadow, - gsize n_shadows, - const char *name, - ...) G_GNUC_PRINTF (4, 5); + gsize n_shadows); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_blend (GtkSnapshot *snapshot, - GskBlendMode blend_mode, - const char *name, - ...) G_GNUC_PRINTF (3, 4); + GskBlendMode blend_mode); GDK_AVAILABLE_IN_ALL void gtk_snapshot_push_cross_fade (GtkSnapshot *snapshot, - double progress, - const char *name, - ...) G_GNUC_PRINTF (3, 4); + double progress); GDK_AVAILABLE_IN_ALL void gtk_snapshot_pop (GtkSnapshot *snapshot); @@ -145,28 +119,34 @@ void gtk_snapshot_append_node (GtkSnapshot GskRenderNode *node); GDK_AVAILABLE_IN_ALL cairo_t * gtk_snapshot_append_cairo (GtkSnapshot *snapshot, - const graphene_rect_t *bounds, - const char *name, - ...) G_GNUC_PRINTF(3, 4); + const graphene_rect_t *bounds); GDK_AVAILABLE_IN_ALL void gtk_snapshot_append_texture (GtkSnapshot *snapshot, GdkTexture *texture, - const graphene_rect_t *bounds, - const char *name, - ...) G_GNUC_PRINTF (4, 5); + const graphene_rect_t *bounds); GDK_AVAILABLE_IN_ALL void gtk_snapshot_append_color (GtkSnapshot *snapshot, const GdkRGBA *color, + const graphene_rect_t *bounds); +GDK_AVAILABLE_IN_ALL +void gtk_snapshot_append_linear_gradient (GtkSnapshot *snapshot, const graphene_rect_t *bounds, - const char *name, - ...) G_GNUC_PRINTF (4, 5); + const graphene_point_t *start_point, + const graphene_point_t *end_point, + const GskColorStop *stops, + gsize n_stops); +GDK_AVAILABLE_IN_ALL +void gtk_snapshot_append_repeating_linear_gradient (GtkSnapshot *snapshot, + const graphene_rect_t *bounds, + const graphene_point_t *start_point, + const graphene_point_t *end_point, + const GskColorStop *stops, + gsize n_stops); /* next function implemented in gskpango.c */ GDK_AVAILABLE_IN_ALL void gtk_snapshot_append_layout (GtkSnapshot *snapshot, PangoLayout *layout, - const GdkRGBA *color, - const char *name, - ...) G_GNUC_PRINTF (4, 5); + const GdkRGBA *color); GDK_AVAILABLE_IN_ALL @@ -204,24 +184,6 @@ void gtk_snapshot_render_insertion_cursor (GtkSnapshot PangoLayout *layout, int index, PangoDirection direction); -GDK_AVAILABLE_IN_ALL -void gtk_snapshot_append_linear_gradient (GtkSnapshot *snapshot, - const graphene_rect_t *bounds, - const graphene_point_t *start_point, - const graphene_point_t *end_point, - const GskColorStop *stops, - gsize n_stops, - const char *name, - ...) G_GNUC_PRINTF (7, 8); -GDK_AVAILABLE_IN_ALL -void gtk_snapshot_append_repeating_linear_gradient (GtkSnapshot *snapshot, - const graphene_rect_t *bounds, - const graphene_point_t *start_point, - const graphene_point_t *end_point, - const GskColorStop *stops, - gsize n_stops, - const char *name, - ...) G_GNUC_PRINTF (7, 8); G_END_DECLS diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h index ba134b779e..d560bbbbc0 100644 --- a/gtk/gtksnapshotprivate.h +++ b/gtk/gtksnapshotprivate.h @@ -27,11 +27,9 @@ typedef struct _GtkSnapshotState GtkSnapshotState; typedef GskRenderNode * (* GtkSnapshotCollectFunc) (GtkSnapshot *snapshot, GtkSnapshotState *state, GskRenderNode **nodes, - guint n_nodes, - const char *name); + guint n_nodes); struct _GtkSnapshotState { - char *name; guint start_node_index; guint n_nodes; @@ -76,6 +74,9 @@ struct _GtkSnapshotState { double progress; GskRenderNode *start_node; } cross_fade; + struct { + char *message; + } debug; } data; }; @@ -96,9 +97,6 @@ struct _GtkSnapshotClass { GObjectClass parent_class; /* it's really GdkSnapshotClass, but don't tell anyone! */ }; -GtkSnapshot * gtk_snapshot_new_child (GtkSnapshot *parent, - const char *name, - ...) G_GNUC_PRINTF (2, 3); void gtk_snapshot_append_node_internal (GtkSnapshot *snapshot, GskRenderNode *node); diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index 34f5491c48..05cf9e785d 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -1787,7 +1787,7 @@ gtk_stack_snapshot_crossfade (GtkWidget *widget, GtkStackPrivate *priv = gtk_stack_get_instance_private (stack); gdouble progress = gtk_progress_tracker_get_progress (&priv->tracker, FALSE); - gtk_snapshot_push_cross_fade (snapshot, progress, "CrossFade<%g>", progress); + gtk_snapshot_push_cross_fade (snapshot, progress); if (priv->last_visible_node) { @@ -1849,9 +1849,7 @@ gtk_stack_snapshot_under (GtkWidget *widget, g_assert_not_reached (); } - gtk_snapshot_push_clip (snapshot, - &GRAPHENE_RECT_INIT(x, y, width, height), - "StackUnder"); + gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT(x, y, width, height)); gtk_widget_snapshot_child (widget, priv->visible_child->widget, @@ -1946,8 +1944,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_record_names (snapshot), - "StackCaptureLastVisibleChild"); + last_visible_snapshot = gtk_snapshot_new (); gtk_widget_snapshot (priv->last_visible_child->widget, last_visible_snapshot); priv->last_visible_node = gtk_snapshot_free_to_node (last_visible_snapshot); } @@ -1957,8 +1954,7 @@ gtk_stack_snapshot (GtkWidget *widget, 0, 0, gtk_widget_get_width (widget), gtk_widget_get_height (widget) - ), - "StackAnimationClip"); + )); switch (priv->active_transition_type) { diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 5ea19b3d7b..0afecc4c46 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -1795,9 +1795,7 @@ snapshot_insertion_cursor (GtkSnapshot *snapshot, cairo_t *cr; get_insertion_cursor_bounds (height, direction, draw_arrow, &bounds); - cr = gtk_snapshot_append_cairo (snapshot, - &bounds, - "%s Cursor", is_primary ? "Primary" : "Secondary"); + cr = gtk_snapshot_append_cairo (snapshot, &bounds); draw_insertion_cursor (context, cr, 0, 0, height, is_primary, direction, draw_arrow); diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c index a636c0ce19..0298f88f03 100644 --- a/gtk/gtktextutil.c +++ b/gtk/gtktextutil.c @@ -226,12 +226,12 @@ gtk_text_util_create_drag_icon (GtkWidget *widget, limit_layout_lines (layout); - snapshot = gtk_snapshot_new (FALSE, "TextDragIcon"); + snapshot = gtk_snapshot_new (); style_context = gtk_widget_get_style_context (widget); gtk_style_context_get_color (style_context, &color); - gtk_snapshot_append_layout (snapshot, layout, &color, "TextDragIcon"); + gtk_snapshot_append_layout (snapshot, layout, &color); paintable = gtk_snapshot_free_to_paintable (snapshot, NULL); g_object_unref (layout); @@ -332,10 +332,9 @@ 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, "RichTextDragIcon"); + snapshot = gtk_snapshot_new (); cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT (0, 0, layout_width, layout_height), - "Text"); + &GRAPHENE_RECT_INIT (0, 0, layout_width, layout_height)); gtk_text_layout_draw (layout, widget, cr); diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 77055a9cbf..193c9a9794 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -5432,9 +5432,9 @@ gtk_text_view_snapshot (GtkWidget *widget, gtk_widget_get_width (widget), gtk_widget_get_height (widget)); - gtk_snapshot_push_clip (snapshot, &bounds, "Textview Clip"); + gtk_snapshot_push_clip (snapshot, &bounds); - cr = gtk_snapshot_append_cairo (snapshot, &bounds, "GtkTextView"); + cr = gtk_snapshot_append_cairo (snapshot, &bounds); context = gtk_widget_get_style_context (widget); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 4de024e1f0..a00c0bd4dd 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -4441,8 +4441,7 @@ gtk_tree_view_snapshot_line (GtkTreeView *tree_view, MIN (y1, y2), ABS (x2 - x1) + 1, ABS (y2 - y1) + 1 - ), - "TreeViewGridLine"); + )); context = gtk_widget_get_style_context (GTK_WIDGET (tree_view)); @@ -4840,8 +4839,7 @@ gtk_tree_view_bin_snapshot (GtkWidget *widget, cell_area.y + cell_area.height / 2, cell_area.x + cell_area.width, 1 - ), - "Separator"); + )); gtk_style_context_restore (context); } @@ -4881,8 +4879,7 @@ gtk_tree_view_bin_snapshot (GtkWidget *widget, cell_area.y + cell_area.height / 2, cell_area.x + cell_area.width, 1 - ), - "Separator"); + )); gtk_style_context_restore (context); } @@ -5144,8 +5141,7 @@ gtk_tree_view_snapshot (GtkWidget *widget, 0, gtk_tree_view_get_effective_header_height (tree_view), width, height - gtk_tree_view_get_effective_header_height (tree_view) - ), - "TreeViewContentClip"); + )); gtk_snapshot_offset (snapshot, - (gint) gtk_adjustment_get_value (tree_view->priv->hadjustment), @@ -5201,8 +5197,7 @@ gtk_tree_view_snapshot (GtkWidget *widget, 0, 0, width, gtk_tree_view_get_effective_header_height (tree_view) - ), - "TreeViewHeaderClip"); + )); gtk_style_context_save (context); gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VIEW); @@ -13709,7 +13704,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, "TreeView DragIcon"); + snapshot = gtk_snapshot_new (); gtk_snapshot_render_background (snapshot, context, 0, 0, @@ -13769,8 +13764,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view, cell_area.y + cell_area.height / 2, cell_area.x + cell_area.width, 1 - ), - "Separator"); + )); gtk_style_context_restore (context); } diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index fdbfc8a3bf..166ec771c1 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -513,8 +513,7 @@ gtk_viewport_snapshot (GtkWidget *widget, &GRAPHENE_RECT_INIT( 0, 0, gtk_widget_get_width (widget), - gtk_widget_get_height (widget)), - "Viewport"); + gtk_widget_get_height (widget))); GTK_WIDGET_CLASS (gtk_viewport_parent_class)->snapshot (widget, snapshot); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 30e43d4ac8..08c5db9bed 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -13037,48 +13037,50 @@ gtk_widget_maybe_add_debug_render_nodes (GtkWidget *widget, get_box_border (style, &border); get_box_padding (style, &padding); + gtk_snapshot_push_debug (snapshot, "Widget layout debugging"); + /* Widget margins */ graphene_rect_init (&bounds, 0, -priv->margin.top, priv->allocation.width, priv->margin.top); - gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin top"); + gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds); graphene_rect_init (&bounds, 0, priv->allocation.height, priv->allocation.width, priv->margin.bottom); - gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin bottom"); + gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds); graphene_rect_init (&bounds, -priv->margin.left, 0, priv->margin.left, priv->allocation.height); - gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin left"); + gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds); graphene_rect_init (&bounds, priv->allocation.width, 0, priv->margin.right, priv->allocation.height); - gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin right"); + gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds); /* CSS Margins */ graphene_rect_init (&bounds, 0, 0, priv->allocation.width, margin.top); - gtk_snapshot_append_color (snapshot, &margin_color, &bounds, "Margin top"); + gtk_snapshot_append_color (snapshot, &margin_color, &bounds); graphene_rect_init (&bounds, 0, priv->allocation.height - margin.bottom, priv->allocation.width, margin.bottom); - gtk_snapshot_append_color (snapshot, &margin_color, &bounds, "Margin bottom"); + gtk_snapshot_append_color (snapshot, &margin_color, &bounds); graphene_rect_init (&bounds, 0, margin.top, margin.left, priv->allocation.height - margin.top - margin.bottom); - gtk_snapshot_append_color (snapshot, &margin_color, &bounds, "Margin left"); + gtk_snapshot_append_color (snapshot, &margin_color, &bounds); graphene_rect_init (&bounds, priv->allocation.width - margin.right, margin.top, margin.right, priv->allocation.height - margin.top - margin.bottom); - gtk_snapshot_append_color (snapshot, &margin_color, &bounds, "Margin right"); + gtk_snapshot_append_color (snapshot, &margin_color, &bounds); /* Padding */ @@ -13087,28 +13089,30 @@ gtk_widget_maybe_add_debug_render_nodes (GtkWidget *widget, margin.top + border.top, priv->allocation.width - margin.left - margin.right - border.left - border.right, padding.top); - gtk_snapshot_append_color (snapshot, &padding_color, &bounds, "Padding top"); + gtk_snapshot_append_color (snapshot, &padding_color, &bounds); graphene_rect_init (&bounds, margin.left + border.left, priv->allocation.height - margin.bottom - border.bottom - padding.bottom, priv->allocation.width - margin.left - margin.right - border.left - border.right, padding.bottom); - gtk_snapshot_append_color (snapshot, &padding_color, &bounds, "Padding bottom"); + gtk_snapshot_append_color (snapshot, &padding_color, &bounds); graphene_rect_init (&bounds, margin.left + border.left, margin.top + border.top + padding.top, padding.left, priv->allocation.height - margin.top - margin.bottom - border.top - border.bottom - padding.top - padding.bottom); - gtk_snapshot_append_color (snapshot, &padding_color, &bounds, "Padding left"); + gtk_snapshot_append_color (snapshot, &padding_color, &bounds); graphene_rect_init (&bounds, priv->allocation.width - margin.right - border.right - padding.right, margin.top + border.top + padding.top, padding.right, priv->allocation.height - margin.top - margin.bottom - border.top - border.bottom - padding.top - padding.bottom); - gtk_snapshot_append_color (snapshot, &padding_color, &bounds, "Padding right"); + gtk_snapshot_append_color (snapshot, &padding_color, &bounds); + + gtk_snapshot_pop (snapshot); } if (GTK_DISPLAY_DEBUG_CHECK (display, BASELINES)) @@ -13133,8 +13137,7 @@ gtk_widget_maybe_add_debug_render_nodes (GtkWidget *widget, priv->allocation.width, 1); gtk_snapshot_append_color (snapshot, &red, - &bounds, - "Baseline Debug"); + &bounds); } } @@ -13150,8 +13153,7 @@ gtk_widget_maybe_add_debug_render_nodes (GtkWidget *widget, gtk_snapshot_append_color (snapshot, &blue, - &bounds, - "Baseline Debug"); + &bounds); priv->highlight_resize = FALSE; gtk_widget_queue_draw (widget); } @@ -13171,7 +13173,13 @@ gtk_widget_create_render_node (GtkWidget *widget, GtkBorder margin, border, padding; GtkSnapshot *snapshot; - snapshot = gtk_snapshot_new_child (parent_snapshot, "%s<%p>", gtk_widget_get_name (widget), widget); + snapshot = gtk_snapshot_new (); + + _gtk_widget_get_allocation (widget, &allocation); + gtk_snapshot_push_debug (snapshot, + "RenderNode for %s %p @ %d x %d", + G_OBJECT_TYPE_NAME (widget), widget, + allocation.width, allocation.height); filter_value = _gtk_style_context_peek_property (_gtk_widget_get_style_context (widget), GTK_CSS_PROPERTY_FILTER); gtk_css_filter_value_push_snapshot (filter_value, snapshot); @@ -13182,10 +13190,8 @@ gtk_widget_create_render_node (GtkWidget *widget, get_box_padding (style, &padding); opacity = priv->alpha / 255.0; - _gtk_widget_get_allocation (widget, &allocation); - if (opacity < 1.0) - gtk_snapshot_push_opacity (snapshot, opacity, "Opacity<%s,%f>", G_OBJECT_TYPE_NAME (widget), opacity); + gtk_snapshot_push_opacity (snapshot, opacity); if (!GTK_IS_WINDOW (widget)) { @@ -13221,6 +13227,8 @@ gtk_widget_create_render_node (GtkWidget *widget, gtk_widget_maybe_add_debug_render_nodes (widget, snapshot); #endif + gtk_snapshot_pop (snapshot); + return gtk_snapshot_free_to_node (snapshot); } @@ -13261,14 +13269,6 @@ gtk_widget_snapshot (GtkWidget *widget, gtk_snapshot_append_node (snapshot, priv->render_node); } -static gboolean -should_record_names (GtkWidget *widget, - GskRenderer *renderer) -{ - return gtk_inspector_is_recording (widget) || - ((gsk_renderer_get_debug_flags (renderer) & GSK_DEBUG_ANY) != 0); -} - void gtk_widget_render (GtkWidget *widget, GdkSurface *surface, @@ -13286,8 +13286,7 @@ gtk_widget_render (GtkWidget *widget, if (renderer == NULL) return; - snapshot = gtk_snapshot_new (should_record_names (widget, renderer), - "Render<%s>", G_OBJECT_TYPE_NAME (widget)); + snapshot = gtk_snapshot_new (); gtk_widget_snapshot (widget, snapshot); root = gtk_snapshot_free_to_node (snapshot); diff --git a/gtk/gtkwidgetpaintable.c b/gtk/gtkwidgetpaintable.c index 81512cb437..d15b1cee4b 100644 --- a/gtk/gtkwidgetpaintable.c +++ b/gtk/gtkwidgetpaintable.c @@ -100,18 +100,12 @@ gtk_widget_paintable_paintable_snapshot (GdkPaintable *paintable, /* need to clip because widgets may draw out of bounds */ gtk_snapshot_push_clip (snapshot, - &GRAPHENE_RECT_INIT(0, 0, width, height), - "WidgetPaintableClip<%g,%g>", - width, height); + &GRAPHENE_RECT_INIT(0, 0, width, height)); graphene_matrix_init_scale (&transform, width / gtk_widget_get_allocated_width (self->widget), height / gtk_widget_get_allocated_height (self->widget), 1.0); - gtk_snapshot_push_transform (snapshot, - &transform, - "WidgetPaintableScale<%g,%g>", - width / gtk_widget_get_allocated_width (self->widget), - height / gtk_widget_get_allocated_height (self->widget)); + gtk_snapshot_push_transform (snapshot, &transform); gtk_widget_snapshot (self->widget, snapshot); @@ -136,7 +130,7 @@ gtk_widget_paintable_paintable_get_current_image (GdkPaintable *paintable) if (width == 0 || height == 0) return gdk_paintable_new_empty (width, height); - snapshot = gtk_snapshot_new (FALSE, "WidgetPaintableCurrentImage"); + snapshot = gtk_snapshot_new (); gdk_paintable_snapshot (GDK_PAINTABLE (self), snapshot, width, height); diff --git a/gtk/inspector/cellrenderergraph.c b/gtk/inspector/cellrenderergraph.c index a8ef669487..e8570fb7fb 100644 --- a/gtk/inspector/cellrenderergraph.c +++ b/gtk/inspector/cellrenderergraph.c @@ -202,8 +202,7 @@ gtk_cell_renderer_graph_snapshot (GtkCellRenderer *cell, &GRAPHENE_RECT_INIT ( background_area->x, background_area->y, background_area->width, background_area->height - ), - "CellGraph"); + )); cairo_set_line_width (cr, 1.0); diff --git a/gtk/inspector/fpsoverlay.c b/gtk/inspector/fpsoverlay.c index a3764099af..07ff181dd3 100644 --- a/gtk/inspector/fpsoverlay.c +++ b/gtk/inspector/fpsoverlay.c @@ -217,15 +217,13 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay, gtk_snapshot_offset (snapshot, bounds.origin.x + bounds.size.width - width, bounds.origin.y); if (overlay_opacity < 1.0) - gtk_snapshot_push_opacity (snapshot, overlay_opacity, "Fps Overlay Opacity: %g", overlay_opacity); + gtk_snapshot_push_opacity (snapshot, overlay_opacity); gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 0.5 }, - &GRAPHENE_RECT_INIT (-1, -1, width + 2, height + 2), - "Fps Overlay background"); + &GRAPHENE_RECT_INIT (-1, -1, width + 2, height + 2)); gtk_snapshot_append_layout (snapshot, layout, - &(GdkRGBA) { 1, 1, 1, 1 }, - "Fps Overlay: %s", fps_string); + &(GdkRGBA) { 1, 1, 1, 1 }); if (overlay_opacity < 1.0) gtk_snapshot_pop (snapshot); gtk_snapshot_offset (snapshot, - bounds.origin.x - bounds.size.width + width, - bounds.origin.y); diff --git a/gtk/inspector/highlightoverlay.c b/gtk/inspector/highlightoverlay.c index c45220bc0e..24874da93b 100644 --- a/gtk/inspector/highlightoverlay.c +++ b/gtk/inspector/highlightoverlay.c @@ -53,8 +53,7 @@ gtk_highlight_overlay_snapshot (GtkInspectorOverlay *overlay, gtk_snapshot_append_color (snapshot, &self->color, - &bounds, - "InspectorHighlight"); + &bounds); } static void diff --git a/gtk/inspector/inspectoroverlay.c b/gtk/inspector/inspectoroverlay.c index 9b9678d0ae..a95c9bc814 100644 --- a/gtk/inspector/inspectoroverlay.c +++ b/gtk/inspector/inspectoroverlay.c @@ -62,7 +62,11 @@ gtk_inspector_overlay_snapshot (GtkInspectorOverlay *self, GskRenderNode *node, GtkWidget *widget) { + gtk_snapshot_push_debug (snapshot, "%s %p", G_OBJECT_TYPE_NAME (self), self); + GTK_INSPECTOR_OVERLAY_GET_CLASS (self)->snapshot (self, snapshot, node, widget); + + gtk_snapshot_pop (snapshot); } void diff --git a/gtk/inspector/rendernodeview.c b/gtk/inspector/rendernodeview.c index d98f86037b..1dbbbdb52a 100644 --- a/gtk/inspector/rendernodeview.c +++ b/gtk/inspector/rendernodeview.c @@ -226,8 +226,7 @@ gtk_render_node_view_snapshot (GtkWidget *widget, graphene_rect_init (&rect, 0, 0, width, height); cr = gtk_snapshot_append_cairo (snapshot, - &rect, - "RenderNodeView"); + &rect); cairo_translate (cr, width / 2.0, height / 2.0); if (width < viewport.width || height < viewport.height) diff --git a/gtk/inspector/updatesoverlay.c b/gtk/inspector/updatesoverlay.c index 59cf9fe3ea..9a5d3069b7 100644 --- a/gtk/inspector/updatesoverlay.c +++ b/gtk/inspector/updatesoverlay.c @@ -227,8 +227,7 @@ gtk_updates_overlay_snapshot (GtkInspectorOverlay *overlay, cairo_region_get_rectangle (draw->region, i, &rect); gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 0, 0, 0.4 * (1 - progress) }, - &GRAPHENE_RECT_INIT(rect.x, rect.y, rect.width, rect.height), - "Debug Updates<%g>", progress); + &GRAPHENE_RECT_INIT(rect.x, rect.y, rect.width, rect.height)); } } } diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c index adc55fcf1f..03273e82b9 100644 --- a/gtk/inspector/window.c +++ b/gtk/inspector/window.c @@ -422,7 +422,7 @@ gtk_inspector_prepare_render (GtkWidget *widget, GtkSnapshot *snapshot; GList *l; - snapshot = gtk_snapshot_new (FALSE, "Inspector Overlay"); + snapshot = gtk_snapshot_new (); gtk_snapshot_append_node (snapshot, node); for (l = iw->overlays; l; l = l->next) diff --git a/tests/showrendernode.c b/tests/showrendernode.c index 3efc1a0daf..d3d7d82fd2 100644 --- a/tests/showrendernode.c +++ b/tests/showrendernode.c @@ -73,8 +73,7 @@ gtk_node_view_snapshot (GtkWidget *widget, gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT ( 0, 0, - gtk_widget_get_width (widget), gtk_widget_get_height (widget)), - "nodeview clip"); + gtk_widget_get_width (widget), gtk_widget_get_height (widget))); gtk_snapshot_append_node (snapshot, self->node); gtk_snapshot_pop (snapshot); } diff --git a/tests/testblur.c b/tests/testblur.c index 5540d6d760..bbbf888da5 100644 --- a/tests/testblur.c +++ b/tests/testblur.c @@ -27,7 +27,7 @@ snapshot_blur (GtkWidget *widget, { GtkBlurBox *box = (GtkBlurBox *) widget; - gtk_snapshot_push_blur (snapshot, box->radius, "blur"); + gtk_snapshot_push_blur (snapshot, box->radius); GTK_WIDGET_CLASS (gtk_blur_box_parent_class)->snapshot (widget, snapshot); diff --git a/tests/testtexture.c b/tests/testtexture.c index 5b124c94bc..be8400d978 100644 --- a/tests/testtexture.c +++ b/tests/testtexture.c @@ -69,7 +69,7 @@ gtk_texture_view_snapshot (GtkWidget *widget, bounds.size.width = MIN (width, gdk_texture_get_width (self->texture)); bounds.size.height = MIN (height, gdk_texture_get_height (self->texture)); - gtk_snapshot_append_texture (snapshot, self->texture, &bounds, "Texture"); + gtk_snapshot_append_texture (snapshot, self->texture, &bounds); } } diff --git a/tests/testwidgetfocus.c b/tests/testwidgetfocus.c index a0a196a50a..fc76ed2235 100644 --- a/tests/testwidgetfocus.c +++ b/tests/testwidgetfocus.c @@ -174,8 +174,7 @@ gtk_focus_widget_snapshot (GtkWidget *widget, GtkSnapshot *snapshot) bounds.size.height = alloc.height; gtk_snapshot_append_color (snapshot, &black, - &bounds, - "Crosshair 1"); + &bounds); bounds.origin.x = -30; bounds.origin.y = self->mouse_y; @@ -183,8 +182,7 @@ gtk_focus_widget_snapshot (GtkWidget *widget, GtkSnapshot *snapshot) bounds.size.height = 1; gtk_snapshot_append_color (snapshot, &black, - &bounds, - "Crosshair 2"); + &bounds); layout = gtk_widget_create_pango_layout (widget, NULL); text = g_strdup_printf ("%.2f×%.2f", self->mouse_x, self->mouse_y); |