GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_transparent_pixelmap_detect.c Lines: 11 11 100.0 %
Date: 2026-03-06 19:21:09 Branches: 10 10 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
/**   PIXELMAP Management (PIXELMAP)                                      */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_widget.h"
28
29
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_widget_transparent_pixelmap_detect              PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    This function detects whether or not a pixelmap contains            */
43
/*    transparency.                                                       */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    pixelmap_id                           Pixelmap ID                   */
48
/*                                                                        */
49
/*  OUTPUT                                                                */
50
/*                                                                        */
51
/*    GX_TRUE or GX_FALSE                                                 */
52
/*                                                                        */
53
/*  CALLS                                                                 */
54
/*                                                                        */
55
/*    _gx_widget_canvas_get                 Retrieve canvas               */
56
/*                                                                        */
57
/*                                                                        */
58
/*  CALLED BY                                                             */
59
/*                                                                        */
60
/*    Application Code                                                    */
61
/*                                                                        */
62
/**************************************************************************/
63
715
GX_BOOL _gx_widget_transparent_pixelmap_detect(GX_WIDGET *widget, GX_RESOURCE_ID pixelmap_id)
64
{
65
GX_PIXELMAP *map;
66
GX_CANVAS   *canvas;
67
GX_DISPLAY  *display;
68
69
715
    if (widget -> gx_widget_status & GX_STATUS_VISIBLE)
70
    {
71
712
        _gx_widget_canvas_get(widget, &canvas);
72
73
712
        if (canvas)
74
        {
75
709
            display = canvas -> gx_canvas_display;
76
77
709
            if (pixelmap_id < display -> gx_display_pixelmap_table_size)
78
            {
79
707
                map = display -> gx_display_pixelmap_table[pixelmap_id];
80
81
707
                if (map)
82
                {
83
704
                    if (map -> gx_pixelmap_flags & (GX_PIXELMAP_TRANSPARENT | GX_PIXELMAP_ALPHA))
84
                    {
85
677
                        return GX_TRUE;
86
                    }
87
                }
88
            }
89
        }
90
    }
91
38
    return GX_FALSE;
92
}
93