1
0
Fork 0
forked from len0rd/rockbox

Respect the 'scroll delay' setting more accurately between scrolling rounds

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29123 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Alexander Levin 2011-01-23 21:49:49 +00:00
parent 480c663e5b
commit fb2d6a7a3a
2 changed files with 20 additions and 9 deletions

View file

@ -435,6 +435,7 @@ void LCDFN(scroll_fn)(void)
int index; int index;
int xpos, ypos; int xpos, ypos;
struct viewport* old_vp = current_vp; struct viewport* old_vp = current_vp;
bool makedelay = false;
for ( index = 0; index < LCDFN(scroll_info).lines; index++ ) { for ( index = 0; index < LCDFN(scroll_info).lines; index++ ) {
s = &LCDFN(scroll_info).scroll[index]; s = &LCDFN(scroll_info).scroll[index];
@ -459,26 +460,31 @@ void LCDFN(scroll_fn)(void)
/* at beginning of line */ /* at beginning of line */
s->offset = 0; s->offset = 0;
s->backward = false; s->backward = false;
s->start_tick = current_tick + LCDFN(scroll_info).delay * 2; makedelay = true;
} }
if (s->offset >= s->width - (current_vp->width - xpos)) { else if (s->offset >= s->width - (current_vp->width - xpos)) {
/* at end of line */ /* at end of line */
s->offset = s->width - (current_vp->width - xpos); s->offset = s->width - (current_vp->width - xpos);
s->backward = true; s->backward = true;
s->start_tick = current_tick + LCDFN(scroll_info).delay * 2; makedelay = true;
} }
} }
else { else {
/* scroll forward the whole time */ /* scroll forward the whole time */
if (s->offset >= s->width) { if (s->offset >= s->width) {
s->offset = 0; s->offset = 0;
s->start_tick = current_tick + LCDFN(scroll_info).delay * 2; makedelay = true;
} }
} }
if (makedelay)
s->start_tick = current_tick + LCDFN(scroll_info).delay +
LCDFN(scroll_info).ticks;
LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width, LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width,
pf->height, s->offset); pf->height, s->offset);
LCDFN(update_viewport_rect)(xpos, ypos, current_vp->width - xpos, LCDFN(update_viewport_rect)(xpos, ypos, current_vp->width - xpos,
pf->height); pf->height);
} }
LCDFN(set_viewport)(old_vp); LCDFN(set_viewport)(old_vp);
} }

View file

@ -569,6 +569,7 @@ void lcd_scroll_fn(void)
int xpos, ypos; int xpos, ypos;
bool update; bool update;
struct viewport* old_vp = current_vp; struct viewport* old_vp = current_vp;
bool makedelay = false;
update = false; update = false;
for ( index = 0; index < lcd_scroll_info.lines; index++ ) { for ( index = 0; index < lcd_scroll_info.lines; index++ ) {
@ -594,23 +595,27 @@ void lcd_scroll_fn(void)
/* at beginning of line */ /* at beginning of line */
s->offset = 0; s->offset = 0;
s->backward = false; s->backward = false;
s->start_tick = current_tick + lcd_scroll_info.delay * 2; makedelay = true;
} }
if (s->offset >= s->len - (current_vp->width - xpos)) { else if (s->offset >= s->len - (current_vp->width - xpos)) {
/* at end of line */ /* at end of line */
s->offset = s->len - (current_vp->width - xpos); s->offset = s->len - (current_vp->width - xpos);
s->backward = true; s->backward = true;
s->start_tick = current_tick + lcd_scroll_info.delay * 2; makedelay = true;
} }
} }
else /* scroll forward the whole time */ else /* scroll forward the whole time */
{ {
if (s->offset >= s->len) { if (s->offset >= s->len) {
s->offset = 0; s->offset = 0;
s->start_tick = current_tick + lcd_scroll_info.delay * 2; makedelay = true;
} }
} }
if (makedelay)
s->start_tick = current_tick + lcd_scroll_info.delay +
lcd_scroll_info.ticks;
lcd_putsxyofs(xpos, ypos, s->offset, s->line); lcd_putsxyofs(xpos, ypos, s->offset, s->line);
update = true; update = true;
} }