lv_stye: style anim return with the dsc

This commit is contained in:
Gabor Kiss-Vamosi
2018-06-15 09:29:10 +02:00
parent 75ea3b9edb
commit bf366ea075
2 changed files with 10 additions and 2 deletions
+7 -1
View File
@@ -218,17 +218,20 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src)
}
#if USE_LV_ANIMATION
/**
* Create an animation from a pre-configured 'lv_style_anim_t' variable
* @param anim pointer to a pre-configured 'lv_style_anim_t' variable (will be copied)
* @return pointer to a descriptor. Really this variable will be animated. (Can be used in `lv_anim_del(dsc, NULL)`)
*/
void lv_style_anim_create(lv_style_anim_t * anim)
void * lv_style_anim_create(lv_style_anim_t * anim)
{
lv_style_anim_dsc_t * dsc;
dsc = lv_mem_alloc(sizeof(lv_style_anim_dsc_t));
dsc->style_anim = anim->style_anim;
memcpy(&dsc->style_start, anim->style_start, sizeof(lv_style_t));
memcpy(&dsc->style_end, anim->style_end, sizeof(lv_style_t));
memcpy(dsc->style_anim, anim->style_start, sizeof(lv_style_t));
dsc->end_cb = anim->end_cb;
@@ -247,7 +250,10 @@ void lv_style_anim_create(lv_style_anim_t * anim)
a.repeat_pause = anim->repeat_pause;
lv_anim_create(&a);
return dsc;
}
#endif
/**********************
* STATIC FUNCTIONS
+3 -1
View File
@@ -151,11 +151,13 @@ void lv_style_init (void);
void lv_style_copy(lv_style_t * dest, const lv_style_t * src);
#if USE_LV_ANIMATION
/**
* Create an animation from a pre-configured 'lv_style_anim_t' variable
* @param anim pointer to a pre-configured 'lv_style_anim_t' variable (will be copied)
* @return pointer to a descriptor. Really this variable will be animated. (Can be used in `lv_anim_del(dsc, NULL)`)
*/
void lv_style_anim_create(lv_style_anim_t * anim);
void * lv_style_anim_create(lv_style_anim_t * anim);
#endif
/*************************