GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_drop_list_background_draw.c Lines: 18 18 100.0 %
Date: 2026-03-06 19:21:09 Branches: 6 6 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
/**   Drop List (List)                                                    */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
#include "gx_api.h"
27
#include "gx_widget.h"
28
#include "gx_system.h"
29
#include "gx_drop_list.h"
30
#include "gx_context.h"
31
#include "gx_canvas.h"
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_drop_list_background_draw                       PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function draws the background of drop list, which is a special */
46
/*    type of widget.                                                     */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    drop list                             Drop List control block       */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    None                                                                */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_widget_border_draw                Draw the border               */
59
/*    _gx_context_pixelmap_get              Retrieve pixelmap image       */
60
/*    _gx_widget_border_width_get           Get the border width          */
61
/*    _gx_widget_client_get                 Find the client area of a     */
62
/*                                            widget                      */
63
/*    _gx_canvas_pixelmap_tile              Tile a pixelmap               */
64
/*    _gx_canvas_pixelmap_draw              Draw a pixelmap               */
65
/*    _gx_widget_background_draw            Draw widget background        */
66
/*                                                                        */
67
/*  CALLED BY                                                             */
68
/*                                                                        */
69
/*    _gx_drop_list_draw                                                  */
70
/*                                                                        */
71
/**************************************************************************/
72
6398
VOID  _gx_drop_list_background_draw(GX_DROP_LIST *drop_list)
73
{
74
GX_RESOURCE_ID      pixelmap_id;
75
GX_PIXELMAP        *map;
76
GX_VALUE            xpos;
77
GX_VALUE            ypos;
78
GX_WIDGET          *widget;
79
GX_VALUE            border_width;
80
GX_COLOR            color;
81
GX_RECTANGLE        client;
82
83
6398
    widget = (GX_WIDGET *)drop_list;
84
6398
    map = GX_NULL;
85
6398
    pixelmap_id = drop_list -> gx_drop_list_pixelmap;
86
87
6398
    if (pixelmap_id)
88
    {
89
1409
        _gx_context_pixelmap_get(pixelmap_id, &map);
90
    }
91
92
6398
    if (map)
93
    {
94
1409
        _gx_widget_border_width_get(widget, &border_width);
95
1409
        color = widget -> gx_widget_normal_fill_color;
96
1409
        _gx_widget_border_draw(widget, GX_COLOR_ID_DEFAULT_BORDER, color, color, GX_TRUE);
97
98
1409
        if (drop_list -> gx_widget_style & GX_STYLE_TILE_BACKGROUND)
99
        {
100
1406
            _gx_widget_client_get(widget, border_width, &client);
101
1406
            _gx_canvas_pixelmap_tile(&client, map);
102
        }
103
        else
104
        {
105
3
            xpos = (GX_VALUE)(widget->gx_widget_clip.gx_rectangle_left + border_width + 1);
106
3
            ypos = (GX_VALUE)(widget->gx_widget_clip.gx_rectangle_top + border_width + 1);
107
3
            _gx_canvas_pixelmap_draw(xpos, ypos, map);
108
        }
109
    }
110
    else
111
    {
112
4989
        _gx_widget_background_draw((GX_WIDGET *)drop_list);
113
    }
114
6398
}
115