[clutter] Debugging cleanups
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] Debugging cleanups
- Date: Fri, 16 Mar 2012 16:20:18 +0000 (UTC)
commit 1df14c1bac2c903466d975946a4c29a892ed28c1
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Fri Mar 16 16:16:40 2012 +0000
Debugging cleanups
Add some more debugging notes to the layout and paint node output.
clutter/clutter-actor.c | 51 +++++++++++++++++++--------------
clutter/clutter-paint-node-private.h | 2 +-
clutter/clutter-paint-nodes.c | 38 ++++++++++++++++++++++++-
3 files changed, 66 insertions(+), 25 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 5483d11..88230ea 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -2056,24 +2056,24 @@ clutter_actor_notify_if_geometry_changed (ClutterActor *self,
}
else
{
- gfloat xu, yu;
- gfloat widthu, heightu;
+ gfloat x, y;
+ gfloat width, height;
- xu = priv->allocation.x1;
- yu = priv->allocation.y1;
- widthu = priv->allocation.x2 - priv->allocation.x1;
- heightu = priv->allocation.y2 - priv->allocation.y1;
+ x = priv->allocation.x1;
+ y = priv->allocation.y1;
+ width = priv->allocation.x2 - priv->allocation.x1;
+ height = priv->allocation.y2 - priv->allocation.y1;
- if (xu != old->x1)
+ if (x != old->x1)
g_object_notify_by_pspec (obj, obj_props[PROP_X]);
- if (yu != old->y1)
+ if (y != old->y1)
g_object_notify_by_pspec (obj, obj_props[PROP_Y]);
- if (widthu != (old->x2 - old->x1))
+ if (width != (old->x2 - old->x1))
g_object_notify_by_pspec (obj, obj_props[PROP_WIDTH]);
- if (heightu != (old->y2 - old->y1))
+ if (height != (old->y2 - old->y1))
g_object_notify_by_pspec (obj, obj_props[PROP_HEIGHT]);
}
@@ -2129,7 +2129,9 @@ clutter_actor_set_allocation_internal (ClutterActor *self,
priv->needs_height_request = FALSE;
priv->needs_allocation = FALSE;
- if (x1_changed || y1_changed || x2_changed || y2_changed || flags_changed)
+ if (x1_changed || y1_changed ||
+ x2_changed || y2_changed ||
+ flags_changed)
{
CLUTTER_NOTE (LAYOUT, "Allocation for '%s' changed",
_clutter_actor_get_debug_name (self));
@@ -3541,30 +3543,22 @@ clutter_actor_continue_paint (ClutterActor *self)
if (_clutter_context_get_pick_mode () == CLUTTER_PICK_NONE)
{
ClutterPaintNode *dummy;
- gboolean emit_paint = TRUE;
/* XXX - this will go away in 2.0, when we can get rid of this
* stuff and switch to a pure retained render tree of PaintNodes
* for the entire frame, starting from the Stage; the paint()
* virtual function can then be called directly.
*/
- dummy = _clutter_dummy_node_new ();
+ dummy = _clutter_dummy_node_new (self);
clutter_paint_node_set_name (dummy, "Root");
/* XXX - for 1.12, we use the return value of paint_node() to
- * set the emit_paint variable.
+ * decide whether we should emit the ::paint signal.
*/
clutter_actor_paint_node (self, dummy);
clutter_paint_node_unref (dummy);
- if (emit_paint || CLUTTER_ACTOR_IS_TOPLEVEL (self))
- g_signal_emit (self, actor_signals[PAINT], 0);
- else
- {
- CLUTTER_NOTE (PAINT, "The actor '%s' painted using PaintNodes, "
- "skipping the emission of the paint signal.",
- _clutter_actor_get_debug_name (self));
- }
+ g_signal_emit (self, actor_signals[PAINT], 0);
}
else
{
@@ -8154,6 +8148,16 @@ clutter_actor_update_constraints (ClutterActor *self,
_clutter_constraint_update_allocation (constraint,
self,
allocation);
+
+ CLUTTER_NOTE (LAYOUT,
+ "Allocation of '%s' after constraint '%s': "
+ "{ %.2f, %.2f, %.2f, %.2f }",
+ _clutter_actor_get_debug_name (self),
+ _clutter_actor_meta_get_debug_name (meta),
+ allocation->x1,
+ allocation->y1,
+ allocation->x2,
+ allocation->y2);
}
}
}
@@ -8372,6 +8376,9 @@ clutter_actor_allocate (ClutterActor *self,
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_RELAYOUT);
+ CLUTTER_NOTE (LAYOUT, "Calling %s::allocate()",
+ _clutter_actor_get_debug_name (self));
+
klass = CLUTTER_ACTOR_GET_CLASS (self);
klass->allocate (self, &real_allocation, flags);
diff --git a/clutter/clutter-paint-node-private.h b/clutter/clutter-paint-node-private.h
index c28fd50..7c68a09 100644
--- a/clutter/clutter-paint-node-private.h
+++ b/clutter/clutter-paint-node-private.h
@@ -108,7 +108,7 @@ ClutterPaintNode * _clutter_root_node_new (CoglFra
CoglBufferBit clear_flags,
const CoglMatrix *matrix);
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix);
-ClutterPaintNode * _clutter_dummy_node_new (void);
+ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor);
void _clutter_paint_node_paint (ClutterPaintNode *root);
void _clutter_paint_node_dump_tree (ClutterPaintNode *root);
diff --git a/clutter/clutter-paint-nodes.c b/clutter/clutter-paint-nodes.c
index 1dc6f13..e78199c 100644
--- a/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter-paint-nodes.c
@@ -42,6 +42,7 @@
#include <pango/pango.h>
#include <cogl/cogl.h>
+#include "clutter-actor-private.h"
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-private.h"
@@ -265,6 +266,8 @@ typedef struct _ClutterPaintNodeClass ClutterDummyNodeClass;
struct _ClutterDummyNode
{
ClutterPaintNode parent_instance;
+
+ ClutterActor *actor;
};
G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE)
@@ -275,12 +278,37 @@ clutter_dummy_node_pre_draw (ClutterPaintNode *node)
return TRUE;
}
+static JsonNode *
+clutter_dummy_node_serialize (ClutterPaintNode *node)
+{
+ ClutterDummyNode *dnode = (ClutterDummyNode *) node;
+ JsonBuilder *builder;
+ JsonNode *res;
+
+ if (dnode->actor == NULL)
+ return json_node_new (JSON_NODE_NULL);
+
+ builder = json_builder_new ();
+ json_builder_begin_object (builder);
+
+ json_builder_set_member_name (builder, "actor");
+ json_builder_add_string_value (builder, _clutter_actor_get_debug_name (dnode->actor));
+
+ json_builder_end_object (builder);
+
+ res = json_builder_get_root (builder);
+ g_object_unref (builder);
+
+ return res;
+}
+
static void
clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
{
ClutterPaintNodeClass *node_class = CLUTTER_PAINT_NODE_CLASS (klass);
node_class->pre_draw = clutter_dummy_node_pre_draw;
+ node_class->serialize = clutter_dummy_node_serialize;
}
static void
@@ -289,9 +317,15 @@ clutter_dummy_node_init (ClutterDummyNode *self)
}
ClutterPaintNode *
-_clutter_dummy_node_new (void)
+_clutter_dummy_node_new (ClutterActor *actor)
{
- return _clutter_paint_node_create (_clutter_dummy_node_get_type ());
+ ClutterPaintNode *res;
+
+ res = _clutter_paint_node_create (_clutter_dummy_node_get_type ());
+
+ ((ClutterDummyNode *) res)->actor = actor;
+
+ return res;
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]