GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_sprite_event_process.c Lines: 17 17 100.0 %
Date: 2024-12-05 08:52:37 Branches: 7 7 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
/**   Sprite Management (Sprite)                                          */
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_widget.h"
29
#include "gx_sprite.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_sprite_event_process                            PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function processes events for the sprite widget.               */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    sprite                                Pointer to sprite control     */
48
/*                                            block                       */
49
/*    event_ptr                             Pointer to event to process   */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_widget_event_process              Call widget event processing  */
58
/*    _gx_sprite_start                      Start the sprite widget       */
59
/*    _gx_sprite_update                     Update the sprite widget      */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    GUIX Internal Code                                                  */
64
/*                                                                        */
65
/*  RELEASE HISTORY                                                       */
66
/*                                                                        */
67
/*    DATE              NAME                      DESCRIPTION             */
68
/*                                                                        */
69
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
70
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
71
/*                                            resulting in version 6.1    */
72
/*                                                                        */
73
/**************************************************************************/
74
813
UINT  _gx_sprite_event_process(GX_SPRITE *sprite, GX_EVENT *event_ptr)
75
{
76
/* GX_EVENT   newevent; */
77
813
GX_WIDGET *widget = (GX_WIDGET *)sprite;
78
79
/* Default status to success.  */
80
813
UINT status =  GX_SUCCESS;
81
82
    /* Process relative to the type of event.  */
83
813
    switch (event_ptr -> gx_event_type)
84
    {
85
244
    case GX_EVENT_SHOW:
86
244
        status = _gx_widget_event_process(widget, event_ptr);
87
88
244
        if (sprite -> gx_widget_style & GX_STYLE_SPRITE_AUTO)
89
        {
90
233
            _gx_sprite_start(sprite, sprite -> gx_sprite_current_frame);
91
        }
92
244
        break;
93
94
75
    case GX_EVENT_TIMER:
95
75
        if (event_ptr -> gx_event_payload.gx_event_timer_id == GX_SPRITE_TIMER)
96
        {
97
74
            _gx_sprite_update(sprite);
98
        }
99
        else
100
        {
101
1
            status = _gx_widget_event_process(widget, event_ptr);
102
        }
103
75
        break;
104
105
494
    default:
106
        /* Call the widget default processing.  */
107
494
        status =  _gx_widget_event_process(widget, event_ptr);
108
    }
109
110
    /* Return completion status.  */
111
813
    return(status);
112
}
113