microvg  8.0.3
microvg
vg_trace.h
1 /*
2  * C
3  *
4  * Copyright 2023-2026 MicroEJ Corp. All rights reserved.
5  * MicroEJ Corp. PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */
7 
8 #if !defined VG_TRACE_H
9 #define VG_TRACE_H
10 
11 #if defined __cplusplus
12 extern "C" {
13 #endif
14 
34 // -----------------------------------------------------------------------------
35 // Includes
36 // -----------------------------------------------------------------------------
37 
38 // include "ui_log.h" for bakcward compatibility with UI Pack [14.4.0-14.5.1]
39 #include "ui_log.h"
40 
41 // -----------------------------------------------------------------------------
42 // Defines
43 // -----------------------------------------------------------------------------
44 
45 /*
46  * Events identifiers
47  */
48 #define LOG_MICROVG_FONT_ID 1
49 
53 #define LOG_MICROVG_FONT_load 0
54 #define LOG_MICROVG_FONT_baseline 1
55 #define LOG_MICROVG_FONT_height 2
56 #define LOG_MICROVG_FONT_stringWidth 3
57 #define LOG_MICROVG_FONT_stringHeight 4
58 
62 #define VG_TRACE_drawPathColor 10
63 #define VG_TRACE_drawPathGradient 11
64 #define VG_TRACE_drawStringColor 12
65 #define VG_TRACE_drawStringGradient 13
66 #define VG_TRACE_drawStringOnCircleColor 14
67 #define VG_TRACE_drawStringOnCircleGradient 15
68 #define VG_TRACE_drawImage 16
69 
73 #define CONCAT_STRINGS(p, s) p ## s
74 #define CONCAT_DEFINES(p, s) CONCAT_STRINGS(p, s)
75 
79 #ifndef UI_TRACE_IMAGE
80 #define UI_TRACE_IMAGE UI_LOG_BUFFER
81 #endif
82 
86 #define LOG_MICROVG_START(event, type) LLTRACE_record_event_u32(LLVG_TRACE_group, event, type);
87 
91 #define LOG_MICROVG_END(event, type) LLTRACE_record_event_end_u32(LLVG_TRACE_group, event, type);
92 
97 #ifndef UI_TRACE_COUNT_ARGS
98 #define UI_TRACE_COUNT_ARGS UI_LOG_COUNT_ARGS
99 #endif
100 #define VG_TRACE_FUNCTION(...) CONCAT(LLTRACE_record_event_u32x, UI_TRACE_COUNT_ARGS(__VA_ARGS__))
101 #define VG_TRACE_OFFSET(fn) CONCAT(VG_TRACE_, fn)
102 #define VG_TRACE_PARAMS(fn, ...) LLVG_TRACE_group, VG_TRACE_OFFSET(fn), __VA_ARGS__
103 
107 #define VG_TRACE_IMAGE(img) ((uint32_t)((img)->data))
108 
112 #define VG_TRACE_START(fn, ...) VG_TRACE_FUNCTION(__VA_ARGS__)(VG_TRACE_PARAMS(fn, __VA_ARGS__))
113 
117 #define VG_TRACE_END(fn, v) LLTRACE_record_event_end_u32(VG_TRACE_PARAMS(fn, v))
118 
122 #define VG_TRACE_DRAW_START(fn, gc, ...) VG_TRACE_START(fn, UI_TRACE_IMAGE(&gc->image), __VA_ARGS__)
123 
127 #define VG_TRACE_DRAW_END VG_TRACE_END
128 
129 // -----------------------------------------------------------------------------
130 // Fields
131 // -----------------------------------------------------------------------------
132 
136 extern int32_t LLVG_TRACE_group;
137 
138 // -----------------------------------------------------------------------------
139 // EOF
140 // -----------------------------------------------------------------------------
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif // !defined VG_TRACE_H
int32_t LLVG_TRACE_group
Identifies the MicroVG group to trace an event.
Definition: vg_helper.c:92