GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_icon_pixelmap_update.c Lines: 10 10 100.0 %
Date: 2026-03-06 19:21:09 Branches: 2 2 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
/**   Icon Management (Icon)                                              */
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
#include "gx_prompt.h"
31
#include "gx_system.h"
32
#include "gx_icon.h"
33
34
35
/**************************************************************************/
36
/*                                                                        */
37
/*  FUNCTION                                               RELEASE        */
38
/*                                                                        */
39
/*    _gx_icon_pixelmap_update                            PORTABLE C      */
40
/*                                                           6.1          */
41
/*  AUTHOR                                                                */
42
/*                                                                        */
43
/*    Kenneth Maxwell, Microsoft Corporation                              */
44
/*                                                                        */
45
/*  DESCRIPTION                                                           */
46
/*                                                                        */
47
/*    Change the pixelmap associated with an icon after the icon has      */
48
/*    been created.                                                       */
49
/*                                                                        */
50
/*  INPUT                                                                 */
51
/*                                                                        */
52
/*    icon                                  Pointer to icon control block */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    None                                                                */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*    _gx_widget_pixelmap_get               Retrieve the pixelmap         */
60
/*                                                                        */
61
/*    _gx_utility_rectangle_define          Defines the icon area         */
62
/*    _gx_widget_resize                     Set up the icon size          */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    _gx_icon_event_process                                              */
67
/*    _gx_icon_pixelmap_set                                               */
68
/*                                                                        */
69
/**************************************************************************/
70
1828
VOID _gx_icon_pixelmap_update(GX_ICON *icon)
71
{
72
GX_RECTANGLE size;
73
GX_PIXELMAP *map;
74
75
1828
    _gx_widget_pixelmap_get((GX_WIDGET *)icon, icon -> gx_icon_normal_pixelmap, &map);
76
77
1828
    if (map)
78
    {
79
1787
        _gx_utility_rectangle_define(&size,
80
1787
                                     icon -> gx_widget_size.gx_rectangle_left,
81
1787
                                     icon -> gx_widget_size.gx_rectangle_top,
82
1787
                                     (GX_VALUE)(icon -> gx_widget_size.gx_rectangle_left + map -> gx_pixelmap_width - 1),
83
1787
                                     (GX_VALUE)(icon -> gx_widget_size.gx_rectangle_top + map -> gx_pixelmap_height - 1));
84
1787
        _gx_widget_resize((GX_WIDGET *)icon, &size);
85
    }
86
1828
}
87