Fix FS#10670 - The first letter of a scrolling line starts to appear at the end

of the line

Thanks to Teruaki Kawashima (teru) for providing this solution


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23132 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Tomer Shalev 2009-10-12 16:31:44 +00:00
parent 13e23dd496
commit 736ea79e63

View file

@ -93,9 +93,15 @@ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
LCDFN(getstringsize)(str, &w, NULL); LCDFN(getstringsize)(str, &w, NULL);
/* center takes precedence */ /* center takes precedence */
if (vp_flags & VP_FLAG_ALIGN_CENTER) if (vp_flags & VP_FLAG_ALIGN_CENTER)
{
x = ((current_vp->width - w)/ 2) + x; x = ((current_vp->width - w)/ 2) + x;
}
else else
{
x = current_vp->width - w - x; x = current_vp->width - w - x;
x += ofs;
ofs = 0;
}
} }
while ((ch = *ucs++) != 0 && x < current_vp->width) while ((ch = *ucs++) != 0 && x < current_vp->width)
@ -133,6 +139,7 @@ static void LCDFN(putsxyofs_style)(int xpos, int ypos,
{ {
int lastmode = current_vp->drawmode; int lastmode = current_vp->drawmode;
int xrect = xpos + MAX(w - offset, 0); int xrect = xpos + MAX(w - offset, 0);
int x = VP_IS_RTL(current_vp) ? xpos : xrect;
#if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR)
int oldfgcolor = current_vp->fg_pattern; int oldfgcolor = current_vp->fg_pattern;
int oldbgcolor = current_vp->bg_pattern; int oldbgcolor = current_vp->bg_pattern;
@ -158,7 +165,7 @@ static void LCDFN(putsxyofs_style)(int xpos, int ypos,
current_vp->fg_pattern = current_vp->lst_pattern; current_vp->fg_pattern = current_vp->lst_pattern;
} }
else { else {
lcd_fillrect(xrect, ypos, current_vp->width - xrect, h); lcd_fillrect(x, ypos, current_vp->width - xrect, h);
current_vp->drawmode = (style & STYLE_INVERT) ? current_vp->drawmode = (style & STYLE_INVERT) ?
(DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
} }
@ -168,7 +175,7 @@ static void LCDFN(putsxyofs_style)(int xpos, int ypos,
#else #else
current_vp->drawmode = DRMODE_SOLID | ((style & STYLE_INVERT) ? current_vp->drawmode = DRMODE_SOLID | ((style & STYLE_INVERT) ?
0 : DRMODE_INVERSEVID); 0 : DRMODE_INVERSEVID);
LCDFN(fillrect)(xrect, ypos, current_vp->width - xrect, h); LCDFN(fillrect)(x, ypos, current_vp->width - xrect, h);
current_vp->drawmode ^= DRMODE_INVERSEVID; current_vp->drawmode ^= DRMODE_INVERSEVID;
LCDFN(putsxyofs)(xpos, ypos, offset, str); LCDFN(putsxyofs)(xpos, ypos, offset, str);
#endif #endif
@ -307,8 +314,7 @@ void LCDFN(scroll_fn)(void)
LCDFN(set_viewport)(s->vp); LCDFN(set_viewport)(s->vp);
if (s->backward ^ VP_IS_RTL(current_vp)) if (s->backward)
/* contrary to LTR, this is "forward" in RTL */
s->offset -= LCDFN(scroll_info).step; s->offset -= LCDFN(scroll_info).step;
else else
s->offset += LCDFN(scroll_info).step; s->offset += LCDFN(scroll_info).step;
@ -318,13 +324,13 @@ void LCDFN(scroll_fn)(void)
ypos = s->y * pf->height; ypos = s->y * pf->height;
if (s->bidir) { /* scroll bidirectional */ if (s->bidir) { /* scroll bidirectional */
if (abs(s->offset) <= 0) { if (s->offset <= 0) {
/* 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; s->start_tick = current_tick + LCDFN(scroll_info).delay * 2;
} }
if (abs(s->offset) >= s->width - (current_vp->width - xpos)) { 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;
@ -333,7 +339,7 @@ void LCDFN(scroll_fn)(void)
} }
else { else {
/* scroll forward the whole time */ /* scroll forward the whole time */
if (abs(s->offset) >= s->width) if (s->offset >= s->width)
s->offset %= s->width; s->offset %= s->width;
} }
LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width, LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width,