GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_animation_slide_landing_start.c Lines: 19 19 100.0 %
Date: 2026-03-06 19:21:09 Branches: 8 8 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_widget.h"
29
#include "gx_system.h"
30
#include "gx_animation.h"
31
#include "gx_utility.h"
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_animation_slide_landing_start                   PORTABLE C      */
38
/*                                                           6.1.11       */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function starts a timer to move the sliding screens to the     */
46
/*      target position step by step.                                     */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    animation                             Pointer to animation control  */
51
/*                                            block                       */
52
/*                                                                        */
53
/*  OUTPUT                                                                */
54
/*                                                                        */
55
/*    status                                Completion status             */
56
/*                                                                        */
57
/*  CALLS                                                                 */
58
/*                                                                        */
59
/*    _gx_system_timer_start                Start a timer for a widget    */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    Application Code                                                    */
64
/*                                                                        */
65
/**************************************************************************/
66
#if (GX_ANIMATION_POOL_SIZE > 0)
67
145
UINT  _gx_animation_slide_landing_start(GX_ANIMATION *animation)
68
{
69
GX_ANIMATION_INFO *info;
70
GX_WIDGET         *target;
71
GX_RECTANGLE      *target_size;
72
73
145
    if ((animation -> gx_animation_slide_target_index_1 >= 0) &&
74
143
        (animation -> gx_animation_status == GX_ANIMATION_IDLE))
75
    {
76
139
        info = &animation -> gx_animation_info;
77
78
139
        if (animation -> gx_animation_slide_target_index_2 >= 0)
79
        {
80
97
            target = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_2];
81
        }
82
        else
83
        {
84
42
            target = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_1];
85
        }
86
87
139
        target_size = &target -> gx_widget_size;
88
89
139
        if (animation -> gx_animation_canvas)
90
        {
91
42
            info -> gx_animation_start_position.gx_point_x = (GX_VALUE)(target_size -> gx_rectangle_left + animation -> gx_animation_canvas -> gx_canvas_display_offset_x);
92
42
            info -> gx_animation_start_position.gx_point_y = (GX_VALUE)(target_size -> gx_rectangle_top + animation -> gx_animation_canvas -> gx_canvas_display_offset_y);
93
        }
94
        else
95
        {
96
97
            info -> gx_animation_start_position.gx_point_x = target_size -> gx_rectangle_left;
97
97
            info -> gx_animation_start_position.gx_point_y = target_size -> gx_rectangle_top;
98
        }
99
100
        /* Start a landing timer. */
101
139
        _gx_system_timer_start(info -> gx_animation_parent, GX_ANIMATION_SLIDE_TIMER,
102
139
                               info -> gx_animation_frame_interval,
103
139
                               info -> gx_animation_frame_interval);
104
105
        /* Set animation status. */
106
139
        animation -> gx_animation_status = GX_ANIMATION_SLIDE_LANDING;
107
139
        info -> gx_animation_steps = animation -> gx_animation_total_steps;
108
    }
109
110
    /* Return completion status code. */
111
145
    return(GX_SUCCESS);
112
}
113
#endif