microui  14.5.5
microui
ui_trace.h
1 /*
2  * Copyright 2024-2026 MicroEJ Corp. All rights reserved.
3  * MicroEJ Corp. PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4  */
5 
6 #if !defined UI_TRACE_H
7 #define UI_TRACE_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
33 // --------------------------------------------------------------------------------
34 // Includes
35 // --------------------------------------------------------------------------------
36 
42 #if !defined UI_LLTRACE
43 #if !defined __has_include
44 #error "Set manually UI_LLTRACE: 0 for MicroEJ Architecture 7.x or 1 for MicroEJ Architecture 8.x"
45 #else
46 #define UI_LLTRACE __has_include("LLTRACE.h")
47 #endif // #if !defined __has_include
48 #endif // #if !defined UI_LLTRACE
49 #if UI_LLTRACE == (0u)
50 #include <trace.h>
51 #else
52 #include <LLTRACE.h>
53 #endif
54 
55 // --------------------------------------------------------------------------------
56 // Defines
57 // --------------------------------------------------------------------------------
58 
62 #ifndef CONCAT
63 #define CONCAT0(p, s) p ## s
64 #define CONCAT(p, s) CONCAT0(p, s)
65 #endif
66 
70 #define UI_TRACE_COUNT_ARGS0(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, Pn, ...) Pn
71 #define UI_TRACE_COUNT_ARGS(...) UI_TRACE_COUNT_ARGS0(-1, ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
72 
76 #define UI_TRACE_BRS_FlushSingle 51
77 #define UI_TRACE_BRS_FlushMulti 52
78 #define UI_TRACE_BRS_RestoreRegion 57
79 
83 #define UI_TRACE_OutOfClip 67
84 #define UI_TRACE_DrawnRegion 68
85 
89 #define UI_TRACE_stringWidth 62
90 #define UI_TRACE_writePixel 80
91 #define UI_TRACE_drawLine 81
92 #define UI_TRACE_drawHorizontalLine 82
93 #define UI_TRACE_drawVerticalLine 83
94 #define UI_TRACE_drawRectangle 84
95 #define UI_TRACE_fillRectangle 85
96 #define UI_TRACE_drawRoundedRectangle 86
97 #define UI_TRACE_fillRoundedRectangle 87
98 #define UI_TRACE_drawCircleArc 88
99 #define UI_TRACE_fillCircleArc 89
100 #define UI_TRACE_drawEllipseArc 90
101 #define UI_TRACE_fillEllipseArc 91
102 #define UI_TRACE_drawEllipse 92
103 #define UI_TRACE_fillEllipse 93
104 #define UI_TRACE_drawCircle 94
105 #define UI_TRACE_fillCircle 95
106 #define UI_TRACE_drawImage 96
107 #define UI_TRACE_drawString 97
108 #define UI_TRACE_drawRenderableString 98
109 
113 #define UI_TRACE_Bilinear 0
114 #define UI_TRACE_NearestNeighbor 1
115 #define UI_TRACE_drawThickFadedPoint 110
116 #define UI_TRACE_drawThickFadedLine 111
117 #define UI_TRACE_drawThickFadedCircle 112
118 #define UI_TRACE_drawThickFadedCircleArc 113
119 #define UI_TRACE_drawThickFadedEllipse 114
120 #define UI_TRACE_drawThickLine 115
121 #define UI_TRACE_drawThickCircle 116
122 #define UI_TRACE_drawThickEllipse 117
123 #define UI_TRACE_drawThickCircleArc 118
124 #define UI_TRACE_drawFlippedImage 130
125 #define UI_TRACE_drawRotatedImage 131
126 #define UI_TRACE_drawScaledImage 132
127 #define UI_TRACE_drawScaledString 133
128 #define UI_TRACE_drawScaledRenderableString 134
129 #define UI_TRACE_drawRotatedCharacter 135
130 
135 #if UI_LLTRACE == (0u)
136 #define LLTRACE_record_event_void TRACE_record_event_void
137 #define LLTRACE_record_event_u32 TRACE_record_event_u32
138 #define LLTRACE_record_event_u32x2 TRACE_record_event_u32x2
139 #define LLTRACE_record_event_u32x3 TRACE_record_event_u32x3
140 #define LLTRACE_record_event_u32x4 TRACE_record_event_u32x4
141 #define LLTRACE_record_event_u32x5 TRACE_record_event_u32x5
142 #define LLTRACE_record_event_u32x6 TRACE_record_event_u32x6
143 #define LLTRACE_record_event_u32x7 TRACE_record_event_u32x7
144 #define LLTRACE_record_event_u32x8 TRACE_record_event_u32x8
145 #define LLTRACE_record_event_u32x9 TRACE_record_event_u32x9
146 #define LLTRACE_record_event_u32x10 TRACE_record_event_u32x10
147 #define LLTRACE_record_event_end TRACE_record_event_end
148 #define LLTRACE_record_event_end_u32 TRACE_record_event_end_u32
149 #endif // if UI_LLTRACE == (0u)
150 
154 #define LLTRACE_record_event_u32x1 LLTRACE_record_event_u32
155 #define UI_TRACE_FUNCTION(...) CONCAT(LLTRACE_record_event_u32x, UI_TRACE_COUNT_ARGS(__VA_ARGS__))
156 #define UI_TRACE_OFFSET(fn) CONCAT(UI_TRACE_, fn)
157 #define UI_TRACE_PARAMS(fn, ...) LLUI_TRACE_group, UI_TRACE_OFFSET(fn), __VA_ARGS__
158 
162 #define UI_TRACE_IMAGE(img) (uint32_t)LLUI_DISPLAY_getAddress(img)
163 
167 #define UI_TRACE_BUFFER(img) (uint32_t)LLUI_DISPLAY_getBufferAddress(img)
168 
172 #define UI_TRACE_START(fn, ...) UI_TRACE_FUNCTION(__VA_ARGS__)(UI_TRACE_PARAMS(fn, __VA_ARGS__))
173 
177 #define UI_TRACE_END(fn, v) LLTRACE_record_event_end_u32(UI_TRACE_PARAMS(fn, v))
178 
182 #define UI_TRACE_DRAW_START(fn, gc, ...) UI_TRACE_START(fn, UI_TRACE_IMAGE(&gc->image), __VA_ARGS__)
183 
187 #define UI_TRACE_DRAW_END UI_TRACE_END
188 
189 // --------------------------------------------------------------------------------
190 // Fields
191 // --------------------------------------------------------------------------------
192 
196 extern int32_t LLUI_TRACE_group;
197 
198 // --------------------------------------------------------------------------------
199 // EOF
200 // --------------------------------------------------------------------------------
201 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif // UI_TRACE_H