Some debug help

Make the bounds of drawing surfaces created by render nodes visible.

Trigger with GSK_DEBUG=surface.
This commit is contained in:
Matthias Clasen 2016-08-06 09:37:47 -04:00 committed by Emmanuele Bassi
parent b371b5da42
commit bde55ccdce
3 changed files with 15 additions and 2 deletions

View File

@ -7,7 +7,8 @@ static const GDebugKey gsk_debug_keys[] = {
{ "cairo", GSK_DEBUG_CAIRO },
{ "opengl", GSK_DEBUG_OPENGL },
{ "shaders", GSK_DEBUG_SHADERS },
{ "transforms", GSK_DEBUG_TRANSFORMS }
{ "transforms", GSK_DEBUG_TRANSFORMS },
{ "surface", GSK_DEBUG_SURFACE }
};
#endif

View File

@ -11,7 +11,8 @@ typedef enum {
GSK_DEBUG_CAIRO = 1 << 2,
GSK_DEBUG_OPENGL = 1 << 3,
GSK_DEBUG_SHADERS = 1 << 4,
GSK_DEBUG_TRANSFORMS = 1 << 5
GSK_DEBUG_TRANSFORMS = 1 << 5,
GSK_DEBUG_SURFACE = 1 << 6
} GskDebugFlags;
typedef enum {

View File

@ -1370,6 +1370,17 @@ gsk_render_node_get_draw_context (GskRenderNode *node)
node->bounds.size.width, node->bounds.size.height);
cairo_clip (res);
if (GSK_DEBUG_CHECK (SURFACE))
{
cairo_save (res);
cairo_rectangle (res,
node->bounds.origin.x + 1, node->bounds.origin.y + 1,
node->bounds.size.width - 2, node->bounds.size.height - 2);
cairo_set_source_rgba (res, 1, 0, 0, 0.5);
cairo_stroke (res);
cairo_restore (res);
}
return res;
}