GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_canvas_hide.c Lines: 20 20 100.0 %
Date: 2026-03-06 19:21:09 Branches: 16 16 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
/**   Canvas Management (Canvas)                                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_system.h"
29
#include "gx_utility.h"
30
#include "gx_canvas.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_canvas_hide                                     PORTABLE C      */
38
/*                                                           6.1.3        */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function makes a canvas invisible                              */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    canvas                                Canvas control block          */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_canvas_dirty_mark                 Set the canvas dirty flag     */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    Application                                                         */
62
/*                                                                        */
63
/**************************************************************************/
64
46
UINT  _gx_canvas_hide(GX_CANVAS *canvas)
65
{
66
VOID         (*hide_function)(INT layer);
67
46
GX_CANVAS   *head = _gx_system_canvas_created_list;
68
GX_RECTANGLE dirty;
69
GX_RECTANGLE combine;
70
71
    /* change canvas status flag. */
72
46
    canvas -> gx_canvas_status &= ~(UINT)(GX_CANVAS_VISIBLE);
73
74
46
    if (canvas -> gx_canvas_hardware_layer >= 0)
75
    {
76
2
        hide_function = canvas -> gx_canvas_display -> gx_display_layer_services -> gx_display_layer_hide;
77
78
2
        if (hide_function)
79
        {
80
1
            hide_function(canvas -> gx_canvas_hardware_layer);
81
1
            return(GX_SUCCESS);
82
        }
83
    }
84
85
    /* mark the canvas dirty so that it get refreshed */
86
45
    _gx_utility_rectangle_define(&dirty, 0, 0, (GX_VALUE)(canvas -> gx_canvas_x_resolution - 1), (GX_VALUE)(canvas -> gx_canvas_y_resolution - 1));
87

45
    if (canvas -> gx_canvas_display_offset_x || canvas -> gx_canvas_display_offset_y)
88
    {
89
39
        _gx_utility_rectangle_shift(&dirty, canvas -> gx_canvas_display_offset_x, canvas -> gx_canvas_display_offset_y);
90
    }
91
92
206
    while (head)
93
    {
94
161
        if (head -> gx_canvas_status & GX_CANVAS_VISIBLE)
95
        {
96
43
            _gx_utility_rectangle_define(&combine, 0, 0, (GX_VALUE)(head -> gx_canvas_x_resolution - 1), (GX_VALUE)(head -> gx_canvas_y_resolution - 1));
97
98

43
            if (head -> gx_canvas_display_offset_x || head -> gx_canvas_display_offset_y)
99
            {
100
2
                _gx_utility_rectangle_shift(&combine, head -> gx_canvas_display_offset_x, head -> gx_canvas_display_offset_y);
101
            }
102
103
43
            _gx_utility_rectangle_combine(&combine, &dirty);
104
43
            _gx_canvas_dirty_mark(head, &combine);
105
        }
106
107
161
        head = head -> gx_canvas_created_next;
108
    }
109
110
    /* Return successful status.  */
111
45
    return(GX_SUCCESS);
112
}
113