mirror of
https://github.com/lvgl/lvgl.git
synced 2024-12-02 22:24:02 +08:00
fix(anim): optimize repeat_count type (#5975)
Signed-off-by: bailinjiang <915290475@qq.com>
This commit is contained in:
parent
dc0210b9c6
commit
ab6ee94aee
@ -23,7 +23,7 @@ extern "C" {
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_ANIM_REPEAT_INFINITE 0xFFFF
|
||||
#define LV_ANIM_REPEAT_INFINITE 0xFFFFFFFF
|
||||
#define LV_ANIM_PLAYTIME_INFINITE 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
@ -146,7 +146,7 @@ struct _lv_anim_t {
|
||||
uint32_t playback_delay; /**< Wait before play back*/
|
||||
uint32_t playback_duration; /**< Duration of playback animation*/
|
||||
uint32_t repeat_delay; /**< Wait before repeat*/
|
||||
uint16_t repeat_cnt; /**< Repeat count for the animation*/
|
||||
uint32_t repeat_cnt; /**< Repeat count for the animation*/
|
||||
union _lv_anim_path_para_t {
|
||||
lv_anim_bezier3_para_t bezier3; /**< Parameter used when path is custom_bezier*/
|
||||
} parameter;
|
||||
@ -344,7 +344,7 @@ static inline void lv_anim_set_playback_delay(lv_anim_t * a, uint32_t delay)
|
||||
* @param a pointer to an initialized `lv_anim_t` variable
|
||||
* @param cnt repeat count or `LV_ANIM_REPEAT_INFINITE` for infinite repetition. 0: to disable repetition.
|
||||
*/
|
||||
static inline void lv_anim_set_repeat_count(lv_anim_t * a, uint16_t cnt)
|
||||
static inline void lv_anim_set_repeat_count(lv_anim_t * a, uint32_t cnt)
|
||||
{
|
||||
a->repeat_cnt = cnt;
|
||||
}
|
||||
@ -436,7 +436,7 @@ static inline uint32_t lv_anim_get_time(const lv_anim_t * a)
|
||||
* @param a pointer to an initialized `lv_anim_t` variable
|
||||
* @return the repeat count or `LV_ANIM_REPEAT_INFINITE` for infinite repetition. 0: disabled repetition.
|
||||
*/
|
||||
static inline uint16_t lv_anim_get_repeat_count(const lv_anim_t * a)
|
||||
static inline uint32_t lv_anim_get_repeat_count(const lv_anim_t * a)
|
||||
{
|
||||
return a->repeat_cnt;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ void lv_animimg_set_duration(lv_obj_t * obj, uint32_t duration)
|
||||
lv_anim_set_playback_delay(&animimg->anim, duration);
|
||||
}
|
||||
|
||||
void lv_animimg_set_repeat_count(lv_obj_t * obj, uint16_t count)
|
||||
void lv_animimg_set_repeat_count(lv_obj_t * obj, uint32_t count)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_animimg_t * animimg = (lv_animimg_t *)obj;
|
||||
@ -126,7 +126,7 @@ uint32_t lv_animimg_get_duration(lv_obj_t * obj)
|
||||
return lv_anim_get_time(&animimg->anim);
|
||||
}
|
||||
|
||||
uint16_t lv_animimg_get_repeat_count(lv_obj_t * obj)
|
||||
uint32_t lv_animimg_get_repeat_count(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_animimg_t * animimg = (lv_animimg_t *)obj;
|
||||
|
@ -93,7 +93,7 @@ void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration);
|
||||
* @param img pointer to an animation image object
|
||||
* @param count the number of times to repeat the animation
|
||||
*/
|
||||
void lv_animimg_set_repeat_count(lv_obj_t * img, uint16_t count);
|
||||
void lv_animimg_set_repeat_count(lv_obj_t * img, uint32_t count);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
@ -125,7 +125,7 @@ uint32_t lv_animimg_get_duration(lv_obj_t * img);
|
||||
* @param img pointer to an animation image object
|
||||
* @return the repeat count
|
||||
*/
|
||||
uint16_t lv_animimg_get_repeat_count(lv_obj_t * img);
|
||||
uint32_t lv_animimg_get_repeat_count(lv_obj_t * img);
|
||||
|
||||
#endif /*LV_USE_ANIMIMG*/
|
||||
|
||||
|
@ -85,9 +85,9 @@ void test_animimg_set_repeat_count_infinite(void)
|
||||
{
|
||||
lv_animimg_set_repeat_count(animimg, LV_ANIM_REPEAT_INFINITE);
|
||||
|
||||
uint16_t actual_count = lv_animimg_get_repeat_count(animimg);
|
||||
uint32_t actual_count = lv_animimg_get_repeat_count(animimg);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT16(actual_count, LV_ANIM_REPEAT_INFINITE);
|
||||
TEST_ASSERT_EQUAL_UINT32(actual_count, LV_ANIM_REPEAT_INFINITE);
|
||||
}
|
||||
|
||||
void test_animimg_start(void)
|
||||
|
Loading…
Reference in New Issue
Block a user