1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Context Management (Context)                                        */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_system.h"
29 #include "gx_display.h"
30 #include "gx_context.h"
31 
32 /* Bring in externs for caller checking code.  */
33 GX_CALLER_CHECKING_EXTERNS
34 
35 /**************************************************************************/
36 /*                                                                        */
37 /*  FUNCTION                                               RELEASE        */
38 /*                                                                        */
39 /*    _gxe_context_string_get                             PORTABLE C      */
40 /*                                                           6.1          */
41 /*  AUTHOR                                                                */
42 /*                                                                        */
43 /*    Kenneth Maxwell, Microsoft Corporation                              */
44 /*                                                                        */
45 /*  DESCRIPTION                                                           */
46 /*                                                                        */
47 /*    This function checks for errors in context pixelmap set call.       */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    pixelmap_id                           Pixelmap resource ID          */
52 /*    return_pixelmap                       Pointer to pixelmap           */
53 /*                                            destination pointer         */
54 /*                                                                        */
55 /*  OUTPUT                                                                */
56 /*                                                                        */
57 /*    status                                Completion status             */
58 /*                                                                        */
59 /*  CALLS                                                                 */
60 /*                                                                        */
61 /*    _gx_context_pixelmap_get              Actual context pixelmap get   */
62 /*                                            call                        */
63 /*                                                                        */
64 /*  CALLED BY                                                             */
65 /*                                                                        */
66 /*    Application Code                                                    */
67 /*    GUIX default draw funtions                                          */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
74 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
78 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gxe_context_string_get(GX_RESOURCE_ID string_id,GX_CONST GX_CHAR ** return_string)79 UINT _gxe_context_string_get(GX_RESOURCE_ID string_id, GX_CONST GX_CHAR **return_string)
80 {
81 UINT status;
82 
83     /* Check for appropriate caller.  */
84     GX_INIT_AND_THREADS_CALLER_CHECKING
85 
86     /* Check for invalid pointer.  */
87     if (return_string == GX_NULL)
88     {
89         return(GX_PTR_ERROR);
90     }
91 
92     if (_gx_system_current_draw_context == GX_NULL)
93     {
94         *return_string = GX_NULL;
95         return GX_INVALID_CONTEXT;
96     }
97 
98     /* Call actual string.  */
99     status = _gx_context_string_get(string_id, return_string);
100 
101     /* Return status.  */
102     return(status);
103 }
104 #endif
105 
106 /**************************************************************************/
107 /*                                                                        */
108 /*  FUNCTION                                               RELEASE        */
109 /*                                                                        */
110 /*    _gxe_context_string_get_ext                         PORTABLE C      */
111 /*                                                           6.1          */
112 /*  AUTHOR                                                                */
113 /*                                                                        */
114 /*    Kenneth Maxwell, Microsoft Corporation                              */
115 /*                                                                        */
116 /*  DESCRIPTION                                                           */
117 /*                                                                        */
118 /*    This function checks for errors in context pixelmap set call.       */
119 /*                                                                        */
120 /*  INPUT                                                                 */
121 /*                                                                        */
122 /*    pixelmap_id                           Pixelmap resource ID          */
123 /*    return_pixelmap                       Pointer to pixelmap           */
124 /*                                            destination pointer         */
125 /*                                                                        */
126 /*  OUTPUT                                                                */
127 /*                                                                        */
128 /*    status                                Completion status             */
129 /*                                                                        */
130 /*  CALLS                                                                 */
131 /*                                                                        */
132 /*    _gx_context_pixelmap_get              Actual context pixelmap get   */
133 /*                                            call                        */
134 /*                                                                        */
135 /*  CALLED BY                                                             */
136 /*                                                                        */
137 /*    Application Code                                                    */
138 /*    GUIX default draw funtions                                          */
139 /*                                                                        */
140 /*  RELEASE HISTORY                                                       */
141 /*                                                                        */
142 /*    DATE              NAME                      DESCRIPTION             */
143 /*                                                                        */
144 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
145 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
146 /*                                            resulting in version 6.1    */
147 /*                                                                        */
148 /**************************************************************************/
_gxe_context_string_get_ext(GX_RESOURCE_ID string_id,GX_STRING * return_string)149 UINT _gxe_context_string_get_ext(GX_RESOURCE_ID string_id, GX_STRING *return_string)
150 {
151 UINT status;
152 
153     /* Check for appropriate caller.  */
154     GX_INIT_AND_THREADS_CALLER_CHECKING
155 
156     /* Check for invalid pointer.  */
157     if (return_string == GX_NULL)
158     {
159         return(GX_PTR_ERROR);
160     }
161 
162     if (_gx_system_current_draw_context == GX_NULL)
163     {
164         return_string -> gx_string_ptr = GX_NULL;
165         return_string -> gx_string_length = 0;
166         return GX_INVALID_CONTEXT;
167     }
168 
169     /* Call actual string.  */
170     status = _gx_context_string_get_ext(string_id, return_string);
171 
172     /* Return status.  */
173     return(status);
174 }
175 
176