Release Clutter 1.11.4 (snapshot)
[profile/ivi/clutter.git] / clutter / clutter-debug.h
1 #ifndef __CLUTTER_DEBUG_H__
2 #define __CLUTTER_DEBUG_H__
3
4 #include <glib.h>
5 #include "clutter-main.h"
6
7 G_BEGIN_DECLS
8
9 typedef enum {
10   CLUTTER_DEBUG_MISC                = 1 << 0,
11   CLUTTER_DEBUG_ACTOR               = 1 << 1,
12   CLUTTER_DEBUG_TEXTURE             = 1 << 2,
13   CLUTTER_DEBUG_EVENT               = 1 << 3,
14   CLUTTER_DEBUG_PAINT               = 1 << 4,
15   CLUTTER_DEBUG_PANGO               = 1 << 5,
16   CLUTTER_DEBUG_BACKEND             = 1 << 6,
17   CLUTTER_DEBUG_SCHEDULER           = 1 << 7,
18   CLUTTER_DEBUG_SCRIPT              = 1 << 8,
19   CLUTTER_DEBUG_SHADER              = 1 << 9,
20   CLUTTER_DEBUG_MULTISTAGE          = 1 << 10,
21   CLUTTER_DEBUG_ANIMATION           = 1 << 11,
22   CLUTTER_DEBUG_LAYOUT              = 1 << 12,
23   CLUTTER_DEBUG_PICK                = 1 << 13,
24   CLUTTER_DEBUG_EVENTLOOP           = 1 << 14,
25   CLUTTER_DEBUG_CLIPPING            = 1 << 15,
26   CLUTTER_DEBUG_OOB_TRANSFORMS      = 1 << 16
27 } ClutterDebugFlag;
28
29 typedef enum {
30   CLUTTER_DEBUG_NOP_PICKING         = 1 << 0,
31   CLUTTER_DEBUG_DUMP_PICK_BUFFERS   = 1 << 1
32 } ClutterPickDebugFlag;
33
34 typedef enum {
35   CLUTTER_DEBUG_DISABLE_SWAP_EVENTS     = 1 << 0,
36   CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
37   CLUTTER_DEBUG_REDRAWS                 = 1 << 2,
38   CLUTTER_DEBUG_PAINT_VOLUMES           = 1 << 3,
39   CLUTTER_DEBUG_DISABLE_CULLING         = 1 << 4,
40   CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
41   CLUTTER_DEBUG_CONTINUOUS_REDRAW       = 1 << 6,
42   CLUTTER_DEBUG_PAINT_DEFORM_TILES      = 1 << 7
43 } ClutterDrawDebugFlag;
44
45 #ifdef CLUTTER_ENABLE_DEBUG
46
47 #define CLUTTER_HAS_DEBUG(type)         ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)
48
49 #ifdef __GNUC__
50
51 /* Try the GCC extension for valists in macros */
52 #define CLUTTER_NOTE(type,x,a...)                       G_STMT_START {  \
53         if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) {                    \
54           _clutter_debug_message ("[" #type "]:" G_STRLOC ": " x, ##a); \
55         }                                               } G_STMT_END
56
57 #else /* !__GNUC__ */
58 /* Try the C99 version; unfortunately, this does not allow us to pass
59  * empty arguments to the macro, which means we have to
60  * do an intemediate printf.
61  */
62 #define CLUTTER_NOTE(type,...)                          G_STMT_START {   \
63         if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) {                     \
64           gchar *_fmt = g_strdup_printf (__VA_ARGS__);                   \
65           _clutter_debug_message ("[" #type "]:" G_STRLOC ": %s", _fmt); \
66           g_free (_fmt);                                                 \
67         }                                               } G_STMT_END
68 #endif
69
70 #else /* !CLUTTER_ENABLE_DEBUG */
71
72 #define CLUTTER_NOTE(type,...)         G_STMT_START { } G_STMT_END
73 #define CLUTTER_HAS_DEBUG(type)        FALSE
74
75 #endif /* CLUTTER_ENABLE_DEBUG */
76
77 extern guint clutter_debug_flags;
78 extern guint clutter_pick_debug_flags;
79 extern guint clutter_paint_debug_flags;
80
81 void    _clutter_debug_messagev         (const char *format,
82                                          va_list     var_args);
83 void    _clutter_debug_message          (const char *format,
84                                          ...);
85
86 G_END_DECLS
87
88 #endif /* __CLUTTER_DEBUG_H__ */