| GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
| Line | Branch | Exec | Source |
1 |
/*************************************************************************** |
||
2 |
* Copyright (c) 2024 Microsoft Corporation |
||
3 |
* Copyright (c) 2026-present Eclipse ThreadX contributors |
||
4 |
* |
||
5 |
* This program and the accompanying materials are made available under the |
||
6 |
* terms of the MIT License which is available at |
||
7 |
* https://opensource.org/licenses/MIT. |
||
8 |
* |
||
9 |
* SPDX-License-Identifier: MIT |
||
10 |
**************************************************************************/ |
||
11 |
|||
12 |
|||
13 |
/**************************************************************************/ |
||
14 |
/**************************************************************************/ |
||
15 |
/** */ |
||
16 |
/** GUIX Component */ |
||
17 |
/** */ |
||
18 |
/** Canvas Management (Canvas) */ |
||
19 |
/** */ |
||
20 |
/**************************************************************************/ |
||
21 |
|||
22 |
#define GX_SOURCE_CODE |
||
23 |
|||
24 |
|||
25 |
/* Include necessary system files. */ |
||
26 |
|||
27 |
#include "gx_api.h" |
||
28 |
#include "gx_canvas.h" |
||
29 |
#include "gx_system.h" |
||
30 |
#include "gx_utility.h" |
||
31 |
|||
32 |
/* Bring in externs for caller checking code. */ |
||
33 |
GX_CALLER_CHECKING_EXTERNS |
||
34 |
|||
35 |
/**************************************************************************/ |
||
36 |
/* */ |
||
37 |
/* FUNCTION RELEASE */ |
||
38 |
/* */ |
||
39 |
/* _gxe_canvas_text_draw PORTABLE C */ |
||
40 |
/* 6.1 */ |
||
41 |
/* AUTHOR */ |
||
42 |
/* */ |
||
43 |
/* Kenneth Maxwell, Microsoft Corporation */ |
||
44 |
/* */ |
||
45 |
/* DESCRIPTION */ |
||
46 |
/* */ |
||
47 |
/* This function checks errors in the screen text draw function call. */ |
||
48 |
/* */ |
||
49 |
/* INPUT */ |
||
50 |
/* */ |
||
51 |
/* x_start x coordinate, text left edge */ |
||
52 |
/* y_start y coordinate, text baseline */ |
||
53 |
/* string String to draw */ |
||
54 |
/* length Length of string to draw */ |
||
55 |
/* */ |
||
56 |
/* OUTPUT */ |
||
57 |
/* */ |
||
58 |
/* status Completion status */ |
||
59 |
/* */ |
||
60 |
/* CALLS */ |
||
61 |
/* */ |
||
62 |
/* _gx_canvas_text_draw The actual function */ |
||
63 |
/* */ |
||
64 |
/* CALLED BY */ |
||
65 |
/* */ |
||
66 |
/* Application Code */ |
||
67 |
/* */ |
||
68 |
/**************************************************************************/ |
||
69 |
#if defined(GX_ENABLE_DEPRECATED_STRING_API) |
||
70 |
9004 |
UINT _gxe_canvas_text_draw(GX_VALUE x_start, GX_VALUE y_start, GX_CONST GX_CHAR *string, INT length) |
|
71 |
{ |
||
72 |
UINT status; |
||
73 |
|||
74 |
/* Check for appropriate caller. */ |
||
75 |
✓✓✓✓ ✓✓ |
9004 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
76 |
|||
77 |
/* Check for invalid input pointers. */ |
||
78 |
✓✓ | 9002 |
if (string == GX_NULL) |
79 |
{ |
||
80 |
2 |
return(GX_PTR_ERROR); |
|
81 |
} |
||
82 |
|||
83 |
✓✓ | 9000 |
if (_gx_system_current_draw_context == GX_NULL) |
84 |
{ |
||
85 |
1 |
return GX_INVALID_CONTEXT; |
|
86 |
} |
||
87 |
|||
88 |
/* Call actual widget height get function. */ |
||
89 |
8999 |
status = _gx_canvas_text_draw(x_start, y_start, string, length); |
|
90 |
|||
91 |
/* Return successful completion. */ |
||
92 |
8999 |
return(status); |
|
93 |
} |
||
94 |
#endif |
||
95 |
|||
96 |
/**************************************************************************/ |
||
97 |
/* */ |
||
98 |
/* FUNCTION RELEASE */ |
||
99 |
/* */ |
||
100 |
/* _gxe_canvas_text_draw_ext PORTABLE C */ |
||
101 |
/* 6.1 */ |
||
102 |
/* AUTHOR */ |
||
103 |
/* */ |
||
104 |
/* Kenneth Maxwell, Microsoft Corporation */ |
||
105 |
/* */ |
||
106 |
/* DESCRIPTION */ |
||
107 |
/* */ |
||
108 |
/* This function checks errors in the screen text draw function call. */ |
||
109 |
/* */ |
||
110 |
/* INPUT */ |
||
111 |
/* */ |
||
112 |
/* x_start x coordinate, text left edge */ |
||
113 |
/* y_start y coordinate, text baseline */ |
||
114 |
/* string String to draw */ |
||
115 |
/* */ |
||
116 |
/* OUTPUT */ |
||
117 |
/* */ |
||
118 |
/* status Completion status */ |
||
119 |
/* */ |
||
120 |
/* CALLS */ |
||
121 |
/* */ |
||
122 |
/* _gx_canvas_text_draw_ext The actual function */ |
||
123 |
/* */ |
||
124 |
/* CALLED BY */ |
||
125 |
/* */ |
||
126 |
/* Application Code */ |
||
127 |
/* */ |
||
128 |
/**************************************************************************/ |
||
129 |
2977 |
UINT _gxe_canvas_text_draw_ext(GX_VALUE x_start, GX_VALUE y_start, GX_CONST GX_STRING *string) |
|
130 |
{ |
||
131 |
UINT status; |
||
132 |
2977 |
UINT text_length = 0; |
|
133 |
|||
134 |
/* Check for appropriate caller. */ |
||
135 |
✓✓✓✓ ✓✓ |
2977 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
136 |
|||
137 |
/* Check for invalid input pointers. */ |
||
138 |
✓✓✓✓ |
2975 |
if ((string == GX_NULL) || (string -> gx_string_ptr == GX_NULL)) |
139 |
{ |
||
140 |
2 |
return(GX_PTR_ERROR); |
|
141 |
} |
||
142 |
|||
143 |
✓✓ | 2973 |
if (_gx_system_current_draw_context == GX_NULL) |
144 |
{ |
||
145 |
1 |
return GX_INVALID_CONTEXT; |
|
146 |
} |
||
147 |
|||
148 |
2972 |
status = _gx_utility_string_length_check(string -> gx_string_ptr, &text_length, string -> gx_string_length); |
|
149 |
|||
150 |
✓✓ | 2972 |
if (status != GX_SUCCESS) |
151 |
{ |
||
152 |
1 |
return status; |
|
153 |
} |
||
154 |
|||
155 |
✓✓ | 2971 |
if (text_length < string -> gx_string_length) |
156 |
{ |
||
157 |
1 |
return GX_INVALID_STRING_LENGTH; |
|
158 |
} |
||
159 |
|||
160 |
/* Call actual widget height get function. */ |
||
161 |
2970 |
status = _gx_canvas_text_draw_ext(x_start, y_start, string); |
|
162 |
|||
163 |
/* Return successful completion. */ |
||
164 |
2970 |
return(status); |
|
165 |
} |
||
166 |
|||
167 |
/**************************************************************************/ |
||
168 |
/* */ |
||
169 |
/* FUNCTION RELEASE */ |
||
170 |
/* */ |
||
171 |
/* _gxe_canvas_aligned_text_draw_ext PORTABLE C */ |
||
172 |
/* 6.1.11 */ |
||
173 |
/* AUTHOR */ |
||
174 |
/* */ |
||
175 |
/* Ting Zhu, Microsoft Corporation */ |
||
176 |
/* */ |
||
177 |
/* DESCRIPTION */ |
||
178 |
/* */ |
||
179 |
/* This function checks errors in the canvas aligned text draw */ |
||
180 |
/* function call. */ |
||
181 |
/* */ |
||
182 |
/* INPUT */ |
||
183 |
/* */ |
||
184 |
/* string String to draw */ |
||
185 |
/* rectangle Drawing area */ |
||
186 |
/* alignment Alignment style */ |
||
187 |
/* */ |
||
188 |
/* OUTPUT */ |
||
189 |
/* */ |
||
190 |
/* status Completion status */ |
||
191 |
/* */ |
||
192 |
/* CALLS */ |
||
193 |
/* */ |
||
194 |
/* _gx_canvas_aligned_text_draw_ext The actual function */ |
||
195 |
/* */ |
||
196 |
/* CALLED BY */ |
||
197 |
/* */ |
||
198 |
/* Application Code */ |
||
199 |
/* */ |
||
200 |
/**************************************************************************/ |
||
201 |
11 |
UINT _gxe_canvas_aligned_text_draw(GX_CONST GX_STRING *string, GX_RECTANGLE *rectangle, ULONG alignment) |
|
202 |
{ |
||
203 |
UINT status; |
||
204 |
11 |
UINT text_length = 0; |
|
205 |
|||
206 |
/* Check for appropriate caller. */ |
||
207 |
✗✓✗✗ ✗✓ |
11 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
208 |
|||
209 |
/* Check for invalid input pointers. */ |
||
210 |
✓✗✓✗ ✗✓ |
11 |
if ((string == GX_NULL) || (rectangle == GX_NULL) || (string -> gx_string_ptr == GX_NULL)) |
211 |
{ |
||
212 |
return GX_PTR_ERROR; |
||
213 |
} |
||
214 |
|||
215 |
✗✓ | 11 |
if (_gx_system_current_draw_context == GX_NULL) |
216 |
{ |
||
217 |
return GX_INVALID_CONTEXT; |
||
218 |
} |
||
219 |
|||
220 |
11 |
status = _gx_utility_string_length_check(string -> gx_string_ptr, &text_length, string -> gx_string_length); |
|
221 |
|||
222 |
✗✓ | 11 |
if (status != GX_SUCCESS) |
223 |
{ |
||
224 |
return status; |
||
225 |
} |
||
226 |
|||
227 |
✗✓ | 11 |
if (text_length < string -> gx_string_length) |
228 |
{ |
||
229 |
return GX_INVALID_STRING_LENGTH; |
||
230 |
} |
||
231 |
|||
232 |
/* Call actual widget height get function. */ |
||
233 |
11 |
status = _gx_canvas_aligned_text_draw(string, rectangle, alignment); |
|
234 |
|||
235 |
/* Return successful completion. */ |
||
236 |
11 |
return(status); |
|
237 |
} |
||
238 |
| Generated by: GCOVR (Version 4.1) |