[gtk+/wip/ebassi/gsk-renderer: 158/194] Allow selective debug spew



commit cef0f7524d5134a6acbe59731ac7d4d98d1fbb2c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 6 10:24:05 2016 -0400

    Allow selective debug spew
    
    I don't think this should stay in the code long-term, but it
    is useful for debugging. It helped me track down some suspicious
    placements of render nodes.

 gsk/gskrendernode.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c
index a58b071..fe34db9 100644
--- a/gsk/gskrendernode.c
+++ b/gsk/gskrendernode.c
@@ -1372,13 +1372,19 @@ gsk_render_node_get_draw_context (GskRenderNode *node)
 
   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);
+      const char *prefix;
+      prefix = g_getenv ("GSK_DEBUG_PREFIX");
+      if (!prefix || g_str_has_prefix (node->name, prefix))
+        {
+          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_line_width (res, 2);
+          cairo_set_source_rgb (res, 1, 0, 0);
+          cairo_stroke (res);
+          cairo_restore (res);
+        }
     }
 
   return res;


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