GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_canvas_drawing_complete.c Lines: 13 13 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
/**   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
#include "gx_display.h"
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_canvas_drawing_complete                         PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function completes drawing on the specified canvas.            */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    canvas                                Canvas control block          */
50
/*    flush                                 If GX_TRUE, the content of    */
51
/*                                            the canvas is flushed to    */
52
/*                                            the display                 */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status                                Completion status             */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    [gx_display_driver_buffer_toggle]     Toggle visible frame buffer   */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    Application Code                                                    */
65
/*    GUIX Internal Code                                                  */
66
/*                                                                        */
67
/**************************************************************************/
68
1882122
UINT  _gx_canvas_drawing_complete(GX_CANVAS *canvas, GX_BOOL flush)
69
{
70
1882122
GX_DISPLAY      *display = canvas -> gx_canvas_display;
71
72
    /* Determing if canvas drawing has been initiated.  */
73
74
1882122
    if (canvas -> gx_canvas_draw_nesting > 0)
75
    {
76
1882120
        if (display -> gx_display_driver_drawing_complete)
77
        {
78
1
            display -> gx_display_driver_drawing_complete(display, canvas);
79
        }
80
81
        /* Decrement the drawing nesting counter.  */
82
1882120
        canvas -> gx_canvas_draw_nesting = (GX_UBYTE)(canvas->gx_canvas_draw_nesting - 1);
83
84
        /* Pop the previous draw context. */
85
1882120
        _gx_system_current_draw_context++;
86
87
1882120
        if (_gx_system_current_draw_context == _gx_system_draw_context_stack_end)
88
        {
89
124949
            _gx_system_current_draw_context = GX_NULL;
90
        }
91
92

1882120
        if (canvas -> gx_canvas_draw_nesting == 0 && flush)
93
        {
94
2671
            canvas -> gx_canvas_display -> gx_display_driver_buffer_toggle(canvas, &canvas -> gx_canvas_dirty_area);
95
96
            /* reset the canvas dirty counter */
97
2671
            canvas -> gx_canvas_draw_count = 0;
98
        }
99
    }
100
101
1882122
    return(GX_SUCCESS);
102
}
103