GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_animation_start.c Lines: 16 16 100.0 %
Date: 2024-12-05 08:52:37 Branches: 20 24 83.3 %

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_canvas.h"
30
#include "gx_animation.h"
31
32
/* Bring in externs for caller checking code.  */
33
GX_CALLER_CHECKING_EXTERNS
34
35
/**************************************************************************/
36
/*                                                                        */
37
/*  FUNCTION                                               RELEASE        */
38
/*                                                                        */
39
/*    _gxe_animation_start                                PORTABLE C      */
40
/*                                                           6.3.0        */
41
/*  AUTHOR                                                                */
42
/*                                                                        */
43
/*    Kenneth Maxwell, Microsoft Corporation                              */
44
/*                                                                        */
45
/*  DESCRIPTION                                                           */
46
/*                                                                        */
47
/*    This function checks for error in animation start call.             */
48
/*                                                                        */
49
/*                                                                        */
50
/*  INPUT                                                                 */
51
/*                                                                        */
52
/*    animation                             Pointer to animation control  */
53
/*                                            block                       */
54
/*    info                                  Animation information         */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_animation_start                   Actual animation start call.  */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/*  RELEASE HISTORY                                                       */
69
/*                                                                        */
70
/*    DATE              NAME                      DESCRIPTION             */
71
/*                                                                        */
72
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
73
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
74
/*                                            resulting in version 6.1    */
75
/*  06-02-2021     Ting Zhu                 Modified comment(s),          */
76
/*                                            removed unnecessary check,  */
77
/*                                            resulting in version 6.1.7  */
78
/*  10-31-2023     Ting Zhu                 Modified comment(s),          */
79
/*                                            added caller check,         */
80
/*                                            resulting in version 6.3.0  */
81
/*                                                                        */
82
/**************************************************************************/
83
72
UINT _gxe_animation_start(GX_ANIMATION *animation, GX_ANIMATION_INFO *info)
84
{
85
    /* Check for appropriate caller.  */
86

72
    GX_INIT_AND_THREADS_CALLER_CHECKING
87
88

72
    if (animation == GX_NULL ||
89
        info == GX_NULL)
90
    {
91
3
        return GX_PTR_ERROR;
92
    }
93
94

69
    if (info->gx_animation_steps < 2 || info->gx_animation_frame_interval < 1)
95
    {
96
2
        return GX_INVALID_VALUE;
97
    }
98
99
67
    if (info -> gx_animation_end_alpha == 0 &&
100
4
        info -> gx_animation_start_alpha == 0)
101
    {
102
1
        return GX_INVALID_VALUE;
103
    }
104
105
66
    if (info -> gx_animation_target == GX_NULL)
106
    {
107
1
        return GX_INVALID_WIDGET;
108
    }
109
65
    if (info -> gx_animation_target -> gx_widget_type == 0)
110
    {
111
        /* target widget has not been created */
112
1
        return GX_INVALID_WIDGET;
113
    }
114
115
    /* Check for invalid animation status. */
116
64
    if (animation -> gx_animation_status != GX_ANIMATION_IDLE)
117
    {
118
2
        return(GX_INVALID_STATUS);
119
    }
120
121
62
    return(_gx_animation_start(animation, info));
122
}
123