GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_animation_slide_landing_start.c Lines: 19 19 100.0 %
Date: 2024-12-05 08:52:37 Branches: 8 8 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
/**   Animation Management (Animation)                                    */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_widget.h"
28
#include "gx_system.h"
29
#include "gx_animation.h"
30
#include "gx_utility.h"
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_animation_slide_landing_start                   PORTABLE C      */
37
/*                                                           6.1.11       */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function starts a timer to move the sliding screens to the     */
45
/*      target position step by step.                                     */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    animation                             Pointer to animation control  */
50
/*                                            block                       */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    status                                Completion status             */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_system_timer_start                Start a timer for a widget    */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    Application Code                                                    */
63
/*                                                                        */
64
/*  RELEASE HISTORY                                                       */
65
/*                                                                        */
66
/*    DATE              NAME                      DESCRIPTION             */
67
/*                                                                        */
68
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
69
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
70
/*                                            resulting in version 6.1    */
71
/*  04-25-2022     Ting Zhu                 Modified comment(s),          */
72
/*                                            added canvas support,       */
73
/*                                            resulting in version 6.1.11 */
74
/*                                                                        */
75
/**************************************************************************/
76
145
UINT  _gx_animation_slide_landing_start(GX_ANIMATION *animation)
77
{
78
GX_ANIMATION_INFO *info;
79
GX_WIDGET         *target;
80
GX_RECTANGLE      *target_size;
81
82
145
    if ((animation -> gx_animation_slide_target_index_1 >= 0) &&
83
143
        (animation -> gx_animation_status == GX_ANIMATION_IDLE))
84
    {
85
139
        info = &animation -> gx_animation_info;
86
87
139
        if (animation -> gx_animation_slide_target_index_2 >= 0)
88
        {
89
97
            target = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_2];
90
        }
91
        else
92
        {
93
42
            target = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_1];
94
        }
95
96
139
        target_size = &target -> gx_widget_size;
97
98
139
        if (animation -> gx_animation_canvas)
99
        {
100
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);
101
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);
102
        }
103
        else
104
        {
105
97
            info -> gx_animation_start_position.gx_point_x = target_size -> gx_rectangle_left;
106
97
            info -> gx_animation_start_position.gx_point_y = target_size -> gx_rectangle_top;
107
        }
108
109
        /* Start a landing timer. */
110
139
        _gx_system_timer_start(info -> gx_animation_parent, GX_ANIMATION_SLIDE_TIMER,
111
139
                               info -> gx_animation_frame_interval,
112
139
                               info -> gx_animation_frame_interval);
113
114
        /* Set animation status. */
115
139
        animation -> gx_animation_status = GX_ANIMATION_SLIDE_LANDING;
116
139
        info -> gx_animation_steps = animation -> gx_animation_total_steps;
117
    }
118
119
    /* Return completion status code. */
120
145
    return(GX_SUCCESS);
121
}
122