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