[gtk+/wip/ebassi/gsk-renderer: 156/194] Some debug help



commit 2cad9d9ce49ca5151cae4feb63c1d944b98461ed
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 6 09:37:47 2016 -0400

    Some debug help
    
    Make the bounds of drawing surfaces created by render nodes visible.
    
    Trigger with GSK_DEBUG=surface.

 gsk/gskdebug.c        |    3 ++-
 gsk/gskdebugprivate.h |    3 ++-
 gsk/gskrendernode.c   |   11 +++++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskdebug.c b/gsk/gskdebug.c
index 1e0dc1c..216e118 100644
--- a/gsk/gskdebug.c
+++ b/gsk/gskdebug.c
@@ -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
 
diff --git a/gsk/gskdebugprivate.h b/gsk/gskdebugprivate.h
index 5ab23b2..ee1857c 100644
--- a/gsk/gskdebugprivate.h
+++ b/gsk/gskdebugprivate.h
@@ -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 {
diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c
index ecf38a2..a58b071 100644
--- a/gsk/gskrendernode.c
+++ b/gsk/gskrendernode.c
@@ -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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]