GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_animation_delete.c Lines: 16 16 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
/**   Animation Management (Animation)                                    */
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_animation.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_animation_delete                                PORTABLE C      */
36
/*                                                           6.1.7        */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Ting Zhu, Microsoft Corporation                                     */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function deletes an animation sequence if the input animation  */
44
/*    pointer is not NULL, otherwise, deletes all animations belong to    */
45
/*    the animation parent.                                               */
46
/*                                                                        */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    target                                Pointer to animation control  */
51
/*                                            block                       */
52
/*    parent                                Pointer to animation parent   */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status                                Completion status             */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*   _gx_animation_stop                     Deactivate an animation       */
61
/*   _gx_system_animation_free              Free system animation         */
62
/*                                                                        */
63
/*  CALLED BY                                                             */
64
/*                                                                        */
65
/*    GUIX Internal Code                                                  */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/**************************************************************************/
69
#if (GX_ANIMATION_POOL_SIZE > 0)
70
3
UINT _gx_animation_delete(GX_ANIMATION *target, GX_WIDGET *parent)
71
{
72
GX_ANIMATION *animation;
73
GX_ANIMATION *next;
74
75
3
    if (target)
76
    {
77
2
        animation = target;
78
    }
79
    else
80
    {
81
1
        animation = _gx_system_animation_list;
82
    }
83
84
7
    while (animation)
85
    {
86
4
        if (target)
87
        {
88
2
            next = GX_NULL;
89
2
            parent = target -> gx_animation_info.gx_animation_parent;
90
        }
91
        else
92
        {
93
2
            next = animation -> gx_animation_next;
94
        }
95
96
4
        if (animation -> gx_animation_info.gx_animation_parent == parent)
97
        {
98
99
            /* Stop animation.  */
100
3
            _gx_animation_stop(animation);
101
102
3
            if (animation -> gx_animation_system_allocated)
103
            {
104
105
                /* If this animation came from the system pool, return it.  */
106
2
                _gx_system_animation_free(animation);
107
            }
108
            else
109
            {
110
                /* Invalid animation.  */
111
1
                animation -> gx_animation_status = 0;
112
            }
113
        }
114
115
4
        animation = next;
116
    }
117
118
3
    return(GX_SUCCESS);
119
}
120
#endif