GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_radial_slider_animation_update.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
/**   Radial Slider Management (Slider)                                   */
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_utility.h"
31
#include "gx_radial_slider.h"
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_radial_slider_animation_update                  PORTABLE C      */
38
/*                                                           6.1.11       */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function updates slider value for each animation step.         */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    slider                                Radial slider control block   */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_utility_easing_function_calculate Calculate next slide angle    */
58
/*                                            with specified easing       */
59
/*                                            function type               */
60
/*    _gx_radial_slider_angle_set           Set radial slider angle       */
61
/*    _gx_system_dirty_mark                 Mark widget as dirty          */
62
/*    _gx_system_timer_stop                 Stop specified timer          */
63
/*    _gx_widget_event_generate             Send event its parent         */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    GUIX Internal Code                                                  */
68
/*                                                                        */
69
/**************************************************************************/
70
136
UINT _gx_radial_slider_animation_update(GX_RADIAL_SLIDER *slider)
71
{
72
136
GX_RADIAL_SLIDER_INFO *info = &slider -> gx_radial_slider_info;
73
136
INT                    current_val = info -> gx_radial_slider_info_current_angle;
74
75
136
    if (slider -> gx_radial_slider_animation_step > 0)
76
    {
77
135
        slider -> gx_radial_slider_animation_step--;
78
79
135
        _gx_utility_easing_function_calculate(slider -> gx_radial_slider_animation_style,
80
135
                                              slider -> gx_radial_slider_start_angle,
81
135
                                              slider -> gx_radial_slider_target_angle,
82
135
                                              slider -> gx_radial_slider_animation_total_steps - slider -> gx_radial_slider_animation_step,
83
135
                                              slider -> gx_radial_slider_animation_total_steps,
84
                                              &current_val);
85
86
        /* set radial slider value. */
87
135
        _gx_radial_slider_angle_set(slider, (GX_VALUE)current_val);
88
89
135
        if (slider -> gx_radial_slider_animation_update_callback)
90
        {
91
            /* Call callback function. */
92
30
            slider -> gx_radial_slider_animation_update_callback(slider);
93
        }
94
95
135
        if (slider -> gx_radial_slider_animation_step == 0)
96
        {
97
9
            _gx_system_timer_stop((GX_WIDGET *)slider, GX_RADIAL_SLIDER_TIMER);
98
99
9
            _gx_widget_event_generate((GX_WIDGET *)slider, GX_EVENT_ANIMATION_COMPLETE, current_val);
100
        }
101
102
135
        if (slider -> gx_widget_status & GX_STATUS_VISIBLE)
103
        {
104
120
            _gx_system_dirty_mark((GX_WIDGET *)slider);
105
        }
106
    }
107
108
136
    return GX_SUCCESS;
109
}
110