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);
0, 0,
allocation.width,
allocation.height
- ),
- "DrawingArea");
+ ));
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
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);
#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
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)
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
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
GtkSnapshot *snapshot;
GdkRGBA fg_color;
graphene_rect_t bounds;
- char *name;
/* house-keeping options */
gboolean is_cached_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);
}
(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
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);
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);
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)
if (G_LIKELY (renderer->is_cached_renderer))
{
renderer->snapshot = NULL;
- g_clear_pointer (&renderer->name, g_free);
G_UNLOCK (cached_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;
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);
&GRAPHENE_RECT_INIT (
day_rect.x + 2, y_loc,
day_rect.width - 2, 1
- ),
- "CalendarDetailSeparator");
+ ));
y_loc += 2;
}
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,
&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);
flags);
gtk_style_context_restore (context);
gtk_snapshot_pop (snapshot);
+ gtk_snapshot_pop (snapshot);
}
/**
&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);
&GRAPHENE_RECT_INIT(
clip.x, clip.y,
clip.width, clip.height
- ),
- "CellTroughClip");
+ ));
gtk_snapshot_render_layout (snapshot, context,
x_pos, y_pos,
&GRAPHENE_RECT_INIT(
clip.x, clip.y,
clip.width, clip.height
- ),
- "CellTroughClip");
+ ));
gtk_snapshot_render_layout (snapshot, context,
x_pos, y_pos,
&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,
&GRAPHENE_RECT_INIT(
background_area->x, background_area->y,
background_area->width, background_area->height
- ),
- "CellTextBackground");
+ ));
}
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
&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,
&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);
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);
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);
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)
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 &&
{ 0, { color->red, color->green, color->blue, 0 } },
{ 1, { color->red, color->green, color->blue, 1 } },
},
- 2,
- "ColorAlphaGradient");
+ 2);
}
}
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);
gtk_snapshot_append_color (snapshot,
&swatch->priv->color,
- &content_box.bounds,
- "ColorSwatch Color");
+ &content_box.bounds);
}
else
{
gtk_snapshot_append_color (snapshot,
&color,
- &content_box.bounds,
- "ColorSwatch Opaque Color");
+ &content_box.bounds);
}
gtk_snapshot_pop (snapshot);
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);
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);
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);
}
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);
}
{
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);
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);
});
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,
(height - texture_height) / 2.0,
texture_width,
texture_height
- ),
- "CssImageIconTheme<%s@%d>", icon_theme->name, icon_theme->scale);
+ ));
if (symbolic)
gtk_snapshot_pop (snapshot);
}
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;
}
&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
{
&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);
}
}
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);
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);
}
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);
{
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;
_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);
}
_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);
}
&GRAPHENE_RECT_INIT (
0, 0,
width, height
- ),
- "DrawingAreaContents");
+ ));
priv->draw_func (self,
cr,
width, height,
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)
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);
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);
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);
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);
}
&GRAPHENE_RECT_INIT (
0, 0,
width, height
- ),
- "IconView Clip");
+ ));
gtk_snapshot_offset (snapshot,
- gtk_adjustment_get_value (icon_view->priv->hadjustment),
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,
{
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);
{
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);
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),
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);
&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);
{
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);
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);
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);
}
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))
0, 0,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget)
- ),
- "Popover");
+ ));
/* Clip to the arrow shape */
cairo_save (cr);
{
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);
}
}
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);
&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),
gtk_snapshot_offset (snapshot, - origin->bounds.origin.x, - origin->bounds.origin.y);
gtk_snapshot_pop (snapshot);
+ gtk_snapshot_pop (snapshot);
}
static void
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]);
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))
gtk_css_shadows_value_snapshot_inset (box_shadow,
snapshot,
&bg.boxes[GTK_CSS_AREA_PADDING_BOX]);
+
+ gtk_snapshot_pop (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);
}
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);
}
{
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
{
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);
}
}
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);
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);
gtk_snapshot_pop (snapshot);
gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
+
+ gtk_snapshot_pop (snapshot);
}
static gboolean
});
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))
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);
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);
0, 0,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget)
- ),
- "RevealerClip");
+ ));
gtk_widget_snapshot_child (widget, child, snapshot);
gtk_snapshot_pop (snapshot);
}
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,
gtk_snapshot_collect_default (GtkSnapshot *snapshot,
GtkSnapshotState *state,
GskRenderNode **nodes,
- guint n_nodes,
- const char *name)
+ guint n_nodes)
{
GskRenderNode *node;
else
{
node = gsk_container_node_new (nodes, n_nodes);
- if (name)
- gsk_render_node_set_name (node, name);
}
return node;
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;
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;
}
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);
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);
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;
previous_state->translate_y);
}
- if (name)
- gsk_render_node_set_name (offset_node, name);
-
gsk_render_node_unref (node);
return offset_node;
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;
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);
}
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);
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;
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);
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;
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
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);
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);
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;
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);
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);
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;
return NULL;
}
- if (name)
- gsk_render_node_set_name (clip_node, name);
-
gsk_render_node_unref (node);
return clip_node;
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;
}
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;
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);
}
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);
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);
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);
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;
}
* 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.
*
**/
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);
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)
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);
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);
}
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;
}
* 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.
**/
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);
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);
/* 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);
}
}
-/**
- * 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
* 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.
*/
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;
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);
* @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;
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);
}
* @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.
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;
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);
}
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);
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;
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);
}
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;
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);
}
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
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);
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
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
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;
double progress;
GskRenderNode *start_node;
} cross_fade;
+ struct {
+ char *message;
+ } debug;
} data;
};
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);
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)
{
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,
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);
}
0, 0,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget)
- ),
- "StackAnimationClip");
+ ));
switch (priv->active_transition_type)
{
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);
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);
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);
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);
MIN (y1, y2),
ABS (x2 - x1) + 1,
ABS (y2 - y1) + 1
- ),
- "TreeViewGridLine");
+ ));
context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
cell_area.y + cell_area.height / 2,
cell_area.x + cell_area.width,
1
- ),
- "Separator");
+ ));
gtk_style_context_restore (context);
}
cell_area.y + cell_area.height / 2,
cell_area.x + cell_area.width,
1
- ),
- "Separator");
+ ));
gtk_style_context_restore (context);
}
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),
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);
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,
cell_area.y + cell_area.height / 2,
cell_area.x + cell_area.width,
1
- ),
- "Separator");
+ ));
gtk_style_context_restore (context);
}
&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);
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 */
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))
priv->allocation.width, 1);
gtk_snapshot_append_color (snapshot,
&red,
- &bounds,
- "Baseline Debug");
+ &bounds);
}
}
gtk_snapshot_append_color (snapshot,
&blue,
- &bounds,
- "Baseline Debug");
+ &bounds);
priv->highlight_resize = FALSE;
gtk_widget_queue_draw (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);
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))
{
gtk_widget_maybe_add_debug_render_nodes (widget, snapshot);
#endif
+ gtk_snapshot_pop (snapshot);
+
return gtk_snapshot_free_to_node (snapshot);
}
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,
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);
/* 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);
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);
&GRAPHENE_RECT_INIT (
background_area->x, background_area->y,
background_area->width, background_area->height
- ),
- "CellGraph");
+ ));
cairo_set_line_width (cr, 1.0);
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);
gtk_snapshot_append_color (snapshot,
&self->color,
- &bounds,
- "InspectorHighlight");
+ &bounds);
}
static void
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
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)
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));
}
}
}
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)
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);
}
{
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);
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);
}
}
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;
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);