diff options
author | Georg Gadinger <nilsding@nilsding.org> | 2020-12-12 01:11:46 +0100 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2020-12-12 05:36:42 +0000 |
commit | 512be370c66bc61ab58bc19971fe9cfb93c031c7 (patch) | |
tree | 090efc3ff0169e3b0f8cb47d9f2efe3aa8afbcd0 /apps/gui | |
parent | b339400531f0fdcdd7d5600f71e3566a91b035e1 (diff) | |
download | rockbox-512be370c66bc61ab58bc19971fe9cfb93c031c7.tar.gz rockbox-512be370c66bc61ab58bc19971fe9cfb93c031c7.zip |
list: reset viewport to avoid corrupting the text in the first line
While using Rockbox for a while on my 1st-gen iPod mini I noticed that
the first entry of a list sometimes displays a wrong character at the
18th column. For example, the ':' character would display as 'z', the
'-' character as 'm', 0x00 would display '@' and so on. Oddly enough
this only occurred when the scrollbar was enabled.
I figured that the call to `display->set_viewport(list_text_vp);` in the
for loop inside `list_draw(...)` causes this. Digging deeper I noticed
that in the `lcd-bitmap-common.c` driver the `current_viewport` was
pointing to the start of the line's text. From what I can tell the
cause of this was that the viewport was set to a struct with a shorter
scope than the entire function.
The actual fix for this is quite straightforward -- once the scrollbar
has been drawn the viewport is now changed back to the default one.
Change-Id: Id6a7bd8f74864641ea1670fedea9d12d764e78c0
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/bitmap/list.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 1d2df73e09..aeaceb2780 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c | |||
@@ -216,6 +216,7 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
216 | indent += SCROLLBAR_WIDTH; | 216 | indent += SCROLLBAR_WIDTH; |
217 | } | 217 | } |
218 | 218 | ||
219 | display->set_viewport(list_text_vp); | ||
219 | for (i=start; i<end && i<list->nb_items; i++) | 220 | for (i=start; i<end && i<list->nb_items; i++) |
220 | { | 221 | { |
221 | /* do the text */ | 222 | /* do the text */ |
@@ -246,7 +247,6 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
246 | } | 247 | } |
247 | line_indent += indent; | 248 | line_indent += indent; |
248 | 249 | ||
249 | display->set_viewport(list_text_vp); | ||
250 | /* position the string at the correct offset place */ | 250 | /* position the string at the correct offset place */ |
251 | int item_width,h; | 251 | int item_width,h; |
252 | display->getstringsize(entry_name, &item_width, &h); | 252 | display->getstringsize(entry_name, &item_width, &h); |