@@ -665,6 +665,9 @@ static void draw_radioButton(nbgl_radio_t *obj, nbgl_obj_t *prevObj, bool comput
665
665
static void draw_progressBar (nbgl_progress_bar_t * obj , nbgl_obj_t * prevObj , bool computePosition )
666
666
{
667
667
#ifdef HAVE_SE_TOUCH
668
+
669
+ #define UNTRACKED_PREVIOUS_STATE 255
670
+
668
671
uint8_t stroke = 3 ; // 3 pixels for border
669
672
670
673
if (computePosition ) {
@@ -679,9 +682,14 @@ static void draw_progressBar(nbgl_progress_bar_t *obj, nbgl_obj_t *prevObj, bool
679
682
// inherit background from parent
680
683
obj -> obj .area .backgroundColor = obj -> obj .parent -> area .backgroundColor ;
681
684
682
- // if previous state is not nul, we will just draw the small added part
685
+ // `obj->previousState` variable allows to control whether if
686
+ // - The progress bar is fully redrawn whatever the progress bar state (`obj->previousState ==
687
+ // 0`).
688
+ // - The progress bar is partially drawn from previous draw
689
+ // (`obj->previousState > 0 and <= 100`). `obj->previousState` is set by the caller before each
690
+ // progress bar redraw. The progress bar state is reset otherwise.
683
691
if (obj -> previousState == 0 ) {
684
- // draw external part if necessary
692
+ // Case of progress bar full draw
685
693
if (obj -> withBorder ) {
686
694
nbgl_drawRoundedBorderedRect ((nbgl_area_t * ) obj ,
687
695
RADIUS_0_PIXELS ,
@@ -694,7 +702,7 @@ static void draw_progressBar(nbgl_progress_bar_t *obj, nbgl_obj_t *prevObj, bool
694
702
(nbgl_area_t * ) obj , RADIUS_0_PIXELS , obj -> obj .area .backgroundColor );
695
703
}
696
704
}
697
- else if (obj -> previousState == 255 ) {
705
+ else if (obj -> previousState == UNTRACKED_PREVIOUS_STATE ) {
698
706
obj -> state = 0 ;
699
707
}
700
708
@@ -725,9 +733,10 @@ static void draw_progressBar(nbgl_progress_bar_t *obj, nbgl_obj_t *prevObj, bool
725
733
// reset previous state to be sure that in case of full redraw of the screen we redraw the
726
734
// full bar
727
735
if (obj -> previousState ) {
728
- obj -> previousState = 255 ;
736
+ obj -> previousState = UNTRACKED_PREVIOUS_STATE ;
737
+ obj -> previousWidth = barWidth ;
729
738
}
730
- obj -> previousWidth = barWidth ;
739
+
731
740
extendRefreshArea (& barArea );
732
741
objRefreshAreaDone = true;
733
742
#else // HAVE_SE_TOUCH
0 commit comments