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_context.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_context_pixelmap_get                            PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This service gets the pixelmap associated with the supplied         */
45 /*      resource ID.                                                      */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    pixelmap_id                           Pixelmap resource ID          */
50 /*    return_pixelmap                       Pointer to pixelmap           */
51 /*                                            destination pointer         */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    status                                Completion status             */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    None                                                                */
60 /*                                                                        */
61 /*  CALLED BY                                                             */
62 /*                                                                        */
63 /*    _gx_checkbox_draw                                                   */
64 /*    _gx_context_pixelmap_set                                            */
65 /*    _gx_icon_button_draw                                                */
66 /*    _gx_icon_draw                                                       */
67 /*    _gx_pixelmap_button_draw                                            */
68 /*    _gx_pixelmap_prompt_draw                                            */
69 /*    _gx_pixelmap_slider_draw                                            */
70 /*    _gx_radio_button_draw                                               */
71 /*    _gx_scroll_thumb_draw                                               */
72 /*    _gx_scrollbar_draw                                                  */
73 /*    _gx_scrollbar_thumb_position_calculate                              */
74 /*    _gx_window_draw                                                     */
75 /*                                                                        */
76 /*  RELEASE HISTORY                                                       */
77 /*                                                                        */
78 /*    DATE              NAME                      DESCRIPTION             */
79 /*                                                                        */
80 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
81 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
82 /*                                            resulting in version 6.1    */
83 /*                                                                        */
84 /**************************************************************************/
_gx_context_pixelmap_get(GX_RESOURCE_ID resource_id,GX_PIXELMAP ** return_pixelmap)85 UINT  _gx_context_pixelmap_get(GX_RESOURCE_ID resource_id, GX_PIXELMAP **return_pixelmap)
86 {
87 GX_DRAW_CONTEXT *context = _gx_system_current_draw_context;
88 GX_DISPLAY      *display;
89 
90     display = context -> gx_draw_context_display;
91 
92     /* Determine if the ID is within range.  */
93     if (resource_id < display -> gx_display_pixelmap_table_size)
94     {
95 
96         /* Yes, the ID is within range. Perform a table lookup and return the
97             pixelmap pointer.  */
98         *return_pixelmap = display -> gx_display_pixelmap_table[resource_id];
99         return(GX_SUCCESS);
100     }
101     else
102     {
103         *return_pixelmap = NULL;
104         return(GX_INVALID_RESOURCE_ID);
105     }
106 }
107 
108