microvg
8.0.0
microvg
bsp
vg
inc
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
15
/*
16
* @brief Provides elements that allow to trace some external events in the MicroVG trace
17
* group.
18
*
19
* The MicroVG trace group is identified by the global LLVG_TRACE_group.
20
*
21
* Notes:
22
* - The first event index is the event 10 (events [0,9] are reserved for MicroVG).
23
* - The number of events is 30 (fixed by MicroVG): [10,39].
24
*
25
* Example:
26
*
27
* #include "vg_trace.h"
28
* LLTRACE_record_event_u32(LLVG_TRACE_group, MY_EVENT_OFFSET, my_event_data);
29
*
30
* @author MicroEJ Developer Team
31
* @version 8.0.0
32
*/
33
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
50
/*
51
* @brief Types of Font events
52
*/
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
59
/*
60
* @brief Identifies the traces used by LLVG_PAINTER_impl.c
61
*/
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
70
/*
71
* @brief Useful macros to concatenate easily some strings and defines.
72
*/
73
#define CONCAT_STRINGS(p, s) p ## s
74
#define CONCAT_DEFINES(p, s) CONCAT_STRINGS(p, s)
75
76
/*
77
* @brief Macro UI_TRACE_IMAGE is only available in UI Pack >= 14.5.2
78
*/
79
#ifndef UI_TRACE_IMAGE
80
#define UI_TRACE_IMAGE UI_LOG_BUFFER
81
#endif
82
83
/*
84
* @brief Macro to add an event and its type.
85
*/
86
#define LOG_MICROVG_START(event, type) LLTRACE_record_event_u32(LLVG_TRACE_group, event, type);
87
88
/*
89
* @brief Macro to notify the end of an event and its type.
90
*/
91
#define LOG_MICROVG_END(event, type) LLTRACE_record_event_end_u32(LLVG_TRACE_group, event, type);
92
93
/*
94
* @brief Macros to call the trace functions.
95
* Macro UI_TRACE_COUNT_ARGS is only available in UI Pack >= 14.5.2
96
*/
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
104
/*
105
* @brief Add the image's address as a trace
106
*/
107
#define VG_TRACE_IMAGE(img) ((uint32_t)((img)->data))
108
109
/*
110
* @brief Starts a VG trace (at least one parameter is required)
111
*/
112
#define VG_TRACE_START(fn, ...) VG_TRACE_FUNCTION(__VA_ARGS__)(VG_TRACE_PARAMS(fn, __VA_ARGS__))
113
114
/*
115
* @brief Ends a VG trace (one parameter is required)
116
*/
117
#define VG_TRACE_END(fn, v) LLTRACE_record_event_end_u32(VG_TRACE_PARAMS(fn, v))
118
119
/*
120
* @brief Starts a VG trace that denotes a drawing (destination "gc" is required)
121
*/
122
#define VG_TRACE_DRAW_START(fn, gc, ...) VG_TRACE_START(fn, UI_TRACE_IMAGE(&gc->image), __VA_ARGS__)
123
124
/*
125
* @brief Ends a VG trace that denotes a drawing
126
*/
127
#define VG_TRACE_DRAW_END VG_TRACE_END
128
129
// -----------------------------------------------------------------------------
130
// Fields
131
// -----------------------------------------------------------------------------
132
133
/*
134
* @brief Identifies the MicroVG group to trace an event.
135
*/
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
Generated by
1.9.1