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.
This commit is contained in:
Benjamin Otte 2018-04-24 03:17:23 +02:00
parent 49f9d2108d
commit 73b4a62f51
67 changed files with 317 additions and 829 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -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);
}
/**

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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))

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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,

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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);

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -53,8 +53,7 @@ gtk_highlight_overlay_snapshot (GtkInspectorOverlay *overlay,
gtk_snapshot_append_color (snapshot,
&self->color,
&bounds,
"InspectorHighlight");
&bounds);
}
static void

View File

@ -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

View File

@ -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)

View File

@ -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));
}
}
}

View File

@ -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)

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);