GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_children_draw.c Lines: 17 17 100.0 %
Date: 2024-12-05 08:52:37 Branches: 12 12 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_children_draw                            PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This service draws all children of widget.                          */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    widget                                Pointer to widget             */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    None                                                                */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_canvas_drawing_complete           Complete drawing on canvas    */
58
/*    _gx_canvas_drawing_initiate           Initiate drawing on canvas    */
59
/*    _gx_utility_rectangle_overlap_detect  Check for overlap             */
60
/*    [gx_widget_draw_function]             Child widget drawing function */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    Application Code                                                    */
65
/*    GUIX Internal Code                                                  */
66
/*                                                                        */
67
/*  RELEASE HISTORY                                                       */
68
/*                                                                        */
69
/*    DATE              NAME                      DESCRIPTION             */
70
/*                                                                        */
71
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
72
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
73
/*                                            resulting in version 6.1    */
74
/*                                                                        */
75
/**************************************************************************/
76
1668521
VOID  _gx_widget_children_draw(GX_WIDGET *widget)
77
{
78
UINT             status;
79
GX_WIDGET       *child;
80
GX_CANVAS       *canvas;
81
GX_DRAW_CONTEXT *context;
82
GX_RECTANGLE    *dirty_area;
83
GX_RECTANGLE     overlap;
84
85
    /* Pickup the first child.  */
86
1668521
    child =   widget -> gx_widget_first_child;
87
88
1668521
    if (!child)
89
    {
90
1303077
        return;
91
    }
92
93
    /* pick up the current context */
94
365444
    context = _gx_system_current_draw_context;
95
96
    /* pickup the current canvas */
97
98
365444
    canvas =  context -> gx_draw_context_canvas;
99
365444
    dirty_area = &(context -> gx_draw_context_dirty);
100
101
    /* Draw all the child widgets that overlap the clipping area.  */
102
103
2513874
    while (child)
104
    {
105
2148430
        if (child -> gx_widget_status & GX_STATUS_VISIBLE)
106
        {
107
2096938
            if (_gx_utility_rectangle_overlap_detect(&child -> gx_widget_clip, dirty_area, &overlap))
108
            {
109
                /* Initiate drawing on this canvas.  */
110
1455703
                status = _gx_canvas_drawing_initiate(canvas, child, &overlap);
111
112
1455703
                if (status == GX_SUCCESS)
113
                {
114
                    /* Yes, draw the child widget.  */
115
1453910
                    child -> gx_widget_draw_function(child);
116
1453910
                    _gx_canvas_drawing_complete(canvas, GX_FALSE);
117
                }
118
                else
119
                {
120
1793
                    if (status == GX_NO_VIEWS)
121
                    {
122
                        /* Complete drawing on this canvas.  */
123
1724
                        _gx_canvas_drawing_complete(canvas, GX_FALSE);
124
                    }
125
                }
126
            }
127
        }
128
129
        /* Move to next child.  */
130
2148430
        child =  child -> gx_widget_next;
131
    }
132
}
133