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

1882107
        if (canvas -> gx_canvas_draw_nesting == 0 && flush)
100
        {
101
2671
            canvas -> gx_canvas_display -> gx_display_driver_buffer_toggle(canvas, &canvas -> gx_canvas_dirty_area);
102
103
            /* reset the canvas dirty counter */
104
2671
            canvas -> gx_canvas_draw_count = 0;
105
        }
106
    }
107
108
1882109
    return(GX_SUCCESS);
109
}
110