GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_child_clipping_update.c Lines: 17 17 100.0 %
Date: 2024-12-05 08:52:37 Branches: 14 14 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
/**   Widget Management (Widget)                                          */
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_canvas.h"
29
#include "gx_utility.h"
30
#include "gx_widget.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_widget_child_clipping_update                    PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    Update the clipping members of each child widget to prevent them    */
46
/*    from drawing outside their parent's area.                           */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    parent                                Pointer to parent widget      */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    None                                                                */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_utility_rectangle_overlap_detect  Detect overlapping widgets    */
59
/*    _gx_widget_child_clipping_update      Updating child clipping area  */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    GUIX Internal Code                                                  */
64
/*    GUIX application code                                               */
65
/*                                                                        */
66
/*  RELEASE HISTORY                                                       */
67
/*                                                                        */
68
/*    DATE              NAME                      DESCRIPTION             */
69
/*                                                                        */
70
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
71
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
72
/*                                            resulting in version 6.1    */
73
/*                                                                        */
74
/**************************************************************************/
75
42379
VOID  _gx_widget_child_clipping_update(GX_WIDGET *parent)
76
{
77
GX_WIDGET *child;
78
GX_WIDGET *win;
79
80
42379
    child = parent -> gx_widget_first_child;
81
82
94006
    while (child)
83
    {
84
66608
        win = child -> gx_widget_parent;
85
66608
        _gx_utility_rectangle_overlap_detect(&win -> gx_widget_clip,
86
                                             &child -> gx_widget_size, &child -> gx_widget_clip);
87
88
66608
        if (win -> gx_widget_type >= GX_TYPE_WINDOW &&
89
46253
            !(child -> gx_widget_status & GX_STATUS_NONCLIENT))
90
        {
91
44482
            _gx_utility_rectangle_overlap_detect(&((GX_WINDOW *)win) -> gx_window_client,
92
                                                 &child -> gx_widget_clip, &child -> gx_widget_clip);
93
        }
94
95
66608
        if (child -> gx_widget_first_child)
96
        {
97
9030
            child = child -> gx_widget_first_child;
98
9030
            continue;
99
        }
100
101

81589
        while ((child -> gx_widget_next == GX_NULL) && (child != parent))
102
        {
103
24011
            child = child -> gx_widget_parent;
104
        }
105
106
57578
        if (child == parent)
107
        {
108
14981
            break;
109
        }
110
111
42597
        child = child -> gx_widget_next;
112
    }
113
42379
}
114