GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_canvas_get.c Lines: 10 10 100.0 %
Date: 2026-03-06 19:21:09 Branches: 4 4 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
/**   Widget Management (Widget)                                          */
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_window.h"
30
#include "gx_system.h"
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_widget_canvas_get                               PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This service gets the widget canvas.                                */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    widget                                Pointer to widget             */
49
/*    return_canvas                         Pointer to destination for    */
50
/*                                          widget's canvas               */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    status                                Completion status             */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_window_root_find                  Find the root window          */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    Application Code                                                    */
63
/*    GUIX Internal Code                                                  */
64
/*                                                                        */
65
/**************************************************************************/
66
997703
UINT _gx_widget_canvas_get(GX_WIDGET *widget, GX_CANVAS **return_canvas)
67
{
68
GX_WINDOW_ROOT  *root;
69
GX_DRAW_CONTEXT *context;
70
UINT             status;
71
72
997703
    status = _gx_window_root_find(widget, &root);
73
74
997703
    if (status == GX_SUCCESS)
75
    {
76
997690
        *return_canvas = root -> gx_window_root_canvas;
77
    }
78
    else
79
    {
80
13
        context = _gx_system_current_draw_context;
81
13
        if (context)
82
        {
83
1
            *return_canvas = context -> gx_draw_context_canvas;
84
1
            status = GX_SUCCESS;
85
        }
86
        else
87
        {
88
12
            *return_canvas = GX_NULL;
89
        }
90
    }
91
92
997703
    return(status);
93
}
94