- if( !next ) break;
- int64_t now = timer->get_difference();
- if( next == first || (draw_flash && now >= draw_flash) ) {
+ while( next && next->age < draw_flash ) {
+ now = timer->get_difference();
+ if( now >= draw_flash ) break;
+ draw(next);
+ if( !next->seq_no ) next->cycle_start = now;
+ int64_t ref_no = (now - next->cycle_start) / 1000. * refresh_rate;
+ int count = ref_no - next->seq_no;
+ if( count < 1 ) count = 1;
+ ref_no = next->seq_no + count;
+ next->age = next->cycle_start + 1000. * ref_no / refresh_rate;
+ if( !next->set_seq_no(ref_no) )
+ next->age = now + 1000.;