GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_widget_text_blend.c Lines: 24 24 100.0 %
Date: 2026-03-06 19:21:09 Branches: 28 28 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
/**   Widget Management (Widget)                                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_widget.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_widget_text_blend                              PORTABLE C      */
39
/*                                                           6.1          */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Kenneth Maxwell, Microsoft Corporation                              */
43
/*                                                                        */
44
/*  DESCRIPTION                                                           */
45
/*                                                                        */
46
/*    This function checks for errors in the widget text blend function   */
47
/*    call.                                                               */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    widget                                Widget control block          */
52
/*    tColor                                Text Color                    */
53
/*    font_id                               Font Id                       */
54
/*    string                                Drawing string                */
55
/*    x_offset                              Drawing position adjustment   */
56
/*    y_offset                              Drawing position adjustment   */
57
/*    alpha                                 Blending value 0-255          */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    status                                Completion status             */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    _gx_widget_text_blend                 Actual widget text blend      */
66
/*                                            function                    */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*                                                                        */
72
/**************************************************************************/
73
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
74
77
UINT  _gxe_widget_text_blend(GX_WIDGET *widget,
75
                             UINT tColor, UINT font_id,
76
                             GX_CONST GX_CHAR *string, INT x_offset, INT y_offset, UCHAR alpha)
77
{
78
UINT status;
79
80
    /* Check for appropriate caller.  */
81

77
    GX_INIT_AND_THREADS_CALLER_CHECKING
82
83
    /* Check for invalid input pointers.  */
84
75
    if (widget == GX_NULL)
85
    {
86
1
        return(GX_PTR_ERROR);
87
    }
88
89
    /* Check for invalid widget. */
90
74
    if (widget -> gx_widget_type == 0)
91
    {
92
1
        return(GX_INVALID_WIDGET);
93
    }
94
95
    /* Call actual widget text blend function.  */
96
73
    status = _gx_widget_text_blend(widget, tColor, font_id, string, x_offset, y_offset, alpha);
97
98
    /* Return completion status.  */
99
73
    return(status);
100
}
101
#endif
102
103
/**************************************************************************/
104
/*                                                                        */
105
/*  FUNCTION                                               RELEASE        */
106
/*                                                                        */
107
/*    _gxe_widget_text_blend_ext                          PORTABLE C      */
108
/*                                                           6.1          */
109
/*  AUTHOR                                                                */
110
/*                                                                        */
111
/*    Kenneth Maxwell, Microsoft Corporation                              */
112
/*                                                                        */
113
/*  DESCRIPTION                                                           */
114
/*                                                                        */
115
/*    This function checks for errors in the widget text blend function   */
116
/*    call.                                                               */
117
/*                                                                        */
118
/*  INPUT                                                                 */
119
/*                                                                        */
120
/*    widget                                Widget control block          */
121
/*    tColor                                Text Color                    */
122
/*    font_id                               Font Id                       */
123
/*    string                                Drawing string                */
124
/*    x_offset                              Drawing position adjustment   */
125
/*    y_offset                              Drawing position adjustment   */
126
/*    alpha                                 Blending value 0-255          */
127
/*                                                                        */
128
/*  OUTPUT                                                                */
129
/*                                                                        */
130
/*    status                                Completion status             */
131
/*                                                                        */
132
/*  CALLS                                                                 */
133
/*                                                                        */
134
/*    _gx_widget_text_blend                 Actual widget text blend      */
135
/*                                            function                    */
136
/*                                                                        */
137
/*  CALLED BY                                                             */
138
/*                                                                        */
139
/*    Application Code                                                    */
140
/*                                                                        */
141
/**************************************************************************/
142
154
UINT    _gxe_widget_text_blend_ext(GX_WIDGET *widget, UINT tColor, UINT font_id,
143
                                   GX_CONST GX_STRING *string, INT x_offset, INT y_offset, UCHAR alpha)
144
{
145
UINT status;
146
154
UINT text_length = 0;
147
148
    /* Check for appropriate caller.  */
149

154
    GX_INIT_AND_THREADS_CALLER_CHECKING
150
151
    /* Check for invalid input pointers.  */
152
152
    if (widget == GX_NULL)
153
    {
154
1
        return(GX_PTR_ERROR);
155
    }
156
157
    /* Check for invalid widget. */
158
151
    if (widget -> gx_widget_type == 0)
159
    {
160
1
        return(GX_INVALID_WIDGET);
161
    }
162
163
150
    if (string)
164
    {
165
149
        if (string -> gx_string_ptr)
166
        {
167
147
            status = _gx_utility_string_length_check(string -> gx_string_ptr, &text_length, string -> gx_string_length);
168
169
147
            if (status != GX_SUCCESS)
170
            {
171
1
                return status;
172
            }
173
        }
174
175
148
        if (text_length != string -> gx_string_length)
176
        {
177
2
            return GX_INVALID_STRING_LENGTH;
178
        }
179
    }
180
181
    /* Call actual widget text blend function.  */
182
147
    status = _gx_widget_text_blend_ext(widget, tColor, font_id, string, x_offset, y_offset, alpha);
183
184
    /* Return completion status.  */
185
147
    return(status);
186
}
187