diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-bitmap-common.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index e768801961..d0d3ddec28 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c | |||
@@ -93,9 +93,15 @@ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str) | |||
93 | LCDFN(getstringsize)(str, &w, NULL); | 93 | LCDFN(getstringsize)(str, &w, NULL); |
94 | /* center takes precedence */ | 94 | /* center takes precedence */ |
95 | if (vp_flags & VP_FLAG_ALIGN_CENTER) | 95 | if (vp_flags & VP_FLAG_ALIGN_CENTER) |
96 | { | ||
96 | x = ((current_vp->width - w)/ 2) + x; | 97 | x = ((current_vp->width - w)/ 2) + x; |
98 | } | ||
97 | else | 99 | else |
100 | { | ||
98 | x = current_vp->width - w - x; | 101 | x = current_vp->width - w - x; |
102 | x += ofs; | ||
103 | ofs = 0; | ||
104 | } | ||
99 | } | 105 | } |
100 | 106 | ||
101 | while ((ch = *ucs++) != 0 && x < current_vp->width) | 107 | while ((ch = *ucs++) != 0 && x < current_vp->width) |
@@ -133,6 +139,7 @@ static void LCDFN(putsxyofs_style)(int xpos, int ypos, | |||
133 | { | 139 | { |
134 | int lastmode = current_vp->drawmode; | 140 | int lastmode = current_vp->drawmode; |
135 | int xrect = xpos + MAX(w - offset, 0); | 141 | int xrect = xpos + MAX(w - offset, 0); |
142 | int x = VP_IS_RTL(current_vp) ? xpos : xrect; | ||
136 | #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) | 143 | #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) |
137 | int oldfgcolor = current_vp->fg_pattern; | 144 | int oldfgcolor = current_vp->fg_pattern; |
138 | int oldbgcolor = current_vp->bg_pattern; | 145 | int oldbgcolor = current_vp->bg_pattern; |
@@ -158,7 +165,7 @@ static void LCDFN(putsxyofs_style)(int xpos, int ypos, | |||
158 | current_vp->fg_pattern = current_vp->lst_pattern; | 165 | current_vp->fg_pattern = current_vp->lst_pattern; |
159 | } | 166 | } |
160 | else { | 167 | else { |
161 | lcd_fillrect(xrect, ypos, current_vp->width - xrect, h); | 168 | lcd_fillrect(x, ypos, current_vp->width - xrect, h); |
162 | current_vp->drawmode = (style & STYLE_INVERT) ? | 169 | current_vp->drawmode = (style & STYLE_INVERT) ? |
163 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; | 170 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; |
164 | } | 171 | } |
@@ -168,7 +175,7 @@ static void LCDFN(putsxyofs_style)(int xpos, int ypos, | |||
168 | #else | 175 | #else |
169 | current_vp->drawmode = DRMODE_SOLID | ((style & STYLE_INVERT) ? | 176 | current_vp->drawmode = DRMODE_SOLID | ((style & STYLE_INVERT) ? |
170 | 0 : DRMODE_INVERSEVID); | 177 | 0 : DRMODE_INVERSEVID); |
171 | LCDFN(fillrect)(xrect, ypos, current_vp->width - xrect, h); | 178 | LCDFN(fillrect)(x, ypos, current_vp->width - xrect, h); |
172 | current_vp->drawmode ^= DRMODE_INVERSEVID; | 179 | current_vp->drawmode ^= DRMODE_INVERSEVID; |
173 | LCDFN(putsxyofs)(xpos, ypos, offset, str); | 180 | LCDFN(putsxyofs)(xpos, ypos, offset, str); |
174 | #endif | 181 | #endif |
@@ -307,8 +314,7 @@ void LCDFN(scroll_fn)(void) | |||
307 | 314 | ||
308 | LCDFN(set_viewport)(s->vp); | 315 | LCDFN(set_viewport)(s->vp); |
309 | 316 | ||
310 | if (s->backward ^ VP_IS_RTL(current_vp)) | 317 | if (s->backward) |
311 | /* contrary to LTR, this is "forward" in RTL */ | ||
312 | s->offset -= LCDFN(scroll_info).step; | 318 | s->offset -= LCDFN(scroll_info).step; |
313 | else | 319 | else |
314 | s->offset += LCDFN(scroll_info).step; | 320 | s->offset += LCDFN(scroll_info).step; |
@@ -318,13 +324,13 @@ void LCDFN(scroll_fn)(void) | |||
318 | ypos = s->y * pf->height; | 324 | ypos = s->y * pf->height; |
319 | 325 | ||
320 | if (s->bidir) { /* scroll bidirectional */ | 326 | if (s->bidir) { /* scroll bidirectional */ |
321 | if (abs(s->offset) <= 0) { | 327 | if (s->offset <= 0) { |
322 | /* at beginning of line */ | 328 | /* at beginning of line */ |
323 | s->offset = 0; | 329 | s->offset = 0; |
324 | s->backward = false; | 330 | s->backward = false; |
325 | s->start_tick = current_tick + LCDFN(scroll_info).delay * 2; | 331 | s->start_tick = current_tick + LCDFN(scroll_info).delay * 2; |
326 | } | 332 | } |
327 | if (abs(s->offset) >= s->width - (current_vp->width - xpos)) { | 333 | if (s->offset >= s->width - (current_vp->width - xpos)) { |
328 | /* at end of line */ | 334 | /* at end of line */ |
329 | s->offset = s->width - (current_vp->width - xpos); | 335 | s->offset = s->width - (current_vp->width - xpos); |
330 | s->backward = true; | 336 | s->backward = true; |
@@ -333,7 +339,7 @@ void LCDFN(scroll_fn)(void) | |||
333 | } | 339 | } |
334 | else { | 340 | else { |
335 | /* scroll forward the whole time */ | 341 | /* scroll forward the whole time */ |
336 | if (abs(s->offset) >= s->width) | 342 | if (s->offset >= s->width) |
337 | s->offset %= s->width; | 343 | s->offset %= s->width; |
338 | } | 344 | } |
339 | LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width, | 345 | LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width, |