GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_canvas_rotated_text_draw.c Lines: 24 24 100.0 %
Date: 2026-03-06 19:21:09 Branches: 32 32 100.0 %

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_rotated_text_draw                       PORTABLE C      */
40
/*                                                           6.1          */
41
/*  AUTHOR                                                                */
42
/*                                                                        */
43
/*    Kenneth Maxwell, Microsoft Corporation                              */
44
/*                                                                        */
45
/*  DESCRIPTION                                                           */
46
/*                                                                        */
47
/*    This function checks error in canvas rotated text draw function.    */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    text                                  pointer to string             */
52
/*    xcenter                               center point for text drawing */
53
/*    ycenter                               center point for text drawing */
54
/*    angle                                 angle at which to rotate text */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_canvas_rotated_text_draw          The actual canvas rotated     */
63
/*                                            text draw function          */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    Application Code                                                    */
68
/*                                                                        */
69
/**************************************************************************/
70
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
71
12
UINT _gxe_canvas_rotated_text_draw(GX_CONST GX_CHAR *text,
72
                                   GX_VALUE xcenter,
73
                                   GX_VALUE ycenter,
74
                                   INT angle)
75
{
76
UINT status;
77
78
    /* Check for invalid caller.  */
79

12
    GX_INIT_AND_THREADS_CALLER_CHECKING
80
81
    /* Check for invalid pointer.  */
82
10
    if (text == GX_NULL)
83
    {
84
2
        return GX_PTR_ERROR;
85
    }
86
87

8
    if (!_gx_system_memory_allocator || !_gx_system_memory_free)
88
    {
89
2
        return GX_SYSTEM_MEMORY_ERROR;
90
    }
91
92
6
    status = _gx_canvas_rotated_text_draw(text, xcenter, ycenter, angle);
93
94
    /* Return completion status code. */
95
6
    return(status);
96
}
97
#endif
98
99
/**************************************************************************/
100
/*                                                                        */
101
/*  FUNCTION                                               RELEASE        */
102
/*                                                                        */
103
/*    _gxe_canvas_rotated_text_draw_ext                   PORTABLE C      */
104
/*                                                           6.1          */
105
/*  AUTHOR                                                                */
106
/*                                                                        */
107
/*    Kenneth Maxwell, Microsoft Corporation                              */
108
/*                                                                        */
109
/*  DESCRIPTION                                                           */
110
/*                                                                        */
111
/*    This function checks error in canvas rotated text draw function.    */
112
/*                                                                        */
113
/*  INPUT                                                                 */
114
/*                                                                        */
115
/*    text                                  pointer to string             */
116
/*    xcenter                               center point for text drawing */
117
/*    ycenter                               center point for text drawing */
118
/*    angle                                 angle at which to rotate text */
119
/*                                                                        */
120
/*  OUTPUT                                                                */
121
/*                                                                        */
122
/*    status                                Completion status             */
123
/*                                                                        */
124
/*  CALLS                                                                 */
125
/*                                                                        */
126
/*    _gx_canvas_rotated_text_draw_ext      The actual canvas rotated     */
127
/*                                            text draw function          */
128
/*                                                                        */
129
/*  CALLED BY                                                             */
130
/*                                                                        */
131
/*    Application Code                                                    */
132
/*                                                                        */
133
/**************************************************************************/
134
372
UINT _gxe_canvas_rotated_text_draw_ext(GX_CONST GX_STRING *text, GX_VALUE xcenter, GX_VALUE ycenter, INT angle)
135
{
136
UINT status;
137
372
UINT text_length = 0;
138
139
    /* Check for invalid caller.  */
140

372
    GX_INIT_AND_THREADS_CALLER_CHECKING
141
142
    /* Check for invalid pointer.  */
143

370
    if ((text == GX_NULL) || (text -> gx_string_ptr == GX_NULL))
144
    {
145
2
        return GX_PTR_ERROR;
146
    }
147
148
368
    if (_gx_system_current_draw_context == GX_NULL)
149
    {
150
1
        return GX_INVALID_CONTEXT;
151
    }
152
153

367
    if (!_gx_system_memory_allocator || !_gx_system_memory_free)
154
    {
155
2
        return GX_SYSTEM_MEMORY_ERROR;
156
    }
157
158
365
    status = _gx_utility_string_length_check(text -> gx_string_ptr, &text_length, text -> gx_string_length);
159
160
365
    if (status != GX_SUCCESS)
161
    {
162
1
        return status;
163
    }
164
165
364
    if (text_length != text -> gx_string_length)
166
    {
167
1
        return GX_INVALID_STRING_LENGTH;
168
    }
169
170
363
    status = _gx_canvas_rotated_text_draw_ext(text, xcenter, ycenter, angle);
171
172
    /* Return completion status code. */
173
363
    return(status);
174
}
175