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_widget.h" |
29 |
|
|
#include "gx_system.h" |
30 |
|
|
#include "gx_canvas.h" |
31 |
|
|
#include "gx_animation.h" |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
/**************************************************************************/ |
35 |
|
|
/* */ |
36 |
|
|
/* FUNCTION RELEASE */ |
37 |
|
|
/* */ |
38 |
|
|
/* _gx_animation_stop PORTABLE C */ |
39 |
|
|
/* 6.1.3 */ |
40 |
|
|
/* AUTHOR */ |
41 |
|
|
/* */ |
42 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
43 |
|
|
/* */ |
44 |
|
|
/* DESCRIPTION */ |
45 |
|
|
/* */ |
46 |
|
|
/* This function stops an animation sequence. */ |
47 |
|
|
/* */ |
48 |
|
|
/* */ |
49 |
|
|
/* INPUT */ |
50 |
|
|
/* */ |
51 |
|
|
/* animation Pointer to animation control */ |
52 |
|
|
/* block */ |
53 |
|
|
/* */ |
54 |
|
|
/* OUTPUT */ |
55 |
|
|
/* */ |
56 |
|
|
/* status Completion status */ |
57 |
|
|
/* */ |
58 |
|
|
/* CALLS */ |
59 |
|
|
/* */ |
60 |
|
|
/* tx_timer_deactivate Deactivate a timer */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLED BY */ |
63 |
|
|
/* */ |
64 |
|
|
/* _gx_animation_complete */ |
65 |
|
|
/* _gx_animation_update */ |
66 |
|
|
/* */ |
67 |
|
|
/**************************************************************************/ |
68 |
|
|
#if (GX_ANIMATION_POOL_SIZE > 0) |
69 |
|
80 |
UINT _gx_animation_stop(GX_ANIMATION *animation) |
70 |
|
|
{ |
71 |
|
80 |
UINT status = GX_SUCCESS; |
72 |
|
|
GX_ANIMATION *previous; |
73 |
|
|
|
74 |
|
|
/* assign IDLE status to this animation structure */ |
75 |
|
80 |
animation -> gx_animation_status = GX_ANIMATION_IDLE; |
76 |
|
|
|
77 |
|
|
/* Remove the animation from the active list */ |
78 |
|
80 |
GX_ENTER_CRITICAL |
79 |
|
|
|
80 |
✓✓ |
80 |
if (_gx_system_animation_list == animation) |
81 |
|
|
{ |
82 |
|
|
/* animation is first in active list */ |
83 |
|
63 |
_gx_system_animation_list = _gx_system_animation_list -> gx_animation_next; |
84 |
|
|
|
85 |
|
|
/* if there are no other active animations or timers, stop the system timer */ |
86 |
✓✓✓✓
|
63 |
if ((_gx_system_active_timer_list == NULL) && (_gx_system_animation_list == NULL)) |
87 |
|
|
{ |
88 |
|
|
#ifdef GX_THREADX_BINDING |
89 |
|
|
#ifndef GX_DISABLE_THREADX_TIMER_SOURCE |
90 |
|
52 |
tx_timer_deactivate(&_gx_system_timer); |
91 |
|
|
#endif |
92 |
|
|
#else |
93 |
|
|
GX_TIMER_STOP; |
94 |
|
|
#endif |
95 |
|
|
} |
96 |
|
|
} |
97 |
|
|
else |
98 |
|
|
{ |
99 |
|
|
/* the animation is not the first, find the previous and |
100 |
|
|
adjust linked list |
101 |
|
|
*/ |
102 |
|
17 |
previous = _gx_system_animation_list; |
103 |
✓✓ |
20 |
while (previous) |
104 |
|
|
{ |
105 |
✓✓ |
17 |
if (previous -> gx_animation_next == animation) |
106 |
|
|
{ |
107 |
|
14 |
previous -> gx_animation_next = animation -> gx_animation_next; |
108 |
|
14 |
break; |
109 |
|
|
} |
110 |
|
3 |
previous = previous -> gx_animation_next; |
111 |
|
|
} |
112 |
|
|
} |
113 |
|
80 |
GX_EXIT_CRITICAL |
114 |
|
80 |
return(status); |
115 |
|
|
} |
116 |
|
|
#endif |