GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_context_pixelmap_get.c Lines: 8 8 100.0 %
Date: 2024-12-05 08:52:37 Branches: 2 2 100.0 %

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