summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Gadinger <nilsding@nilsding.org>2020-12-12 01:11:46 +0100
committerWilliam Wilgus <me.theuser@yahoo.com>2020-12-12 05:36:42 +0000
commit512be370c66bc61ab58bc19971fe9cfb93c031c7 (patch)
tree090efc3ff0169e3b0f8cb47d9f2efe3aa8afbcd0
parentb339400531f0fdcdd7d5600f71e3566a91b035e1 (diff)
downloadrockbox-512be370c66bc61ab58bc19971fe9cfb93c031c7.tar.gz
rockbox-512be370c66bc61ab58bc19971fe9cfb93c031c7.tar.bz2
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
-rw-r--r--apps/gui/bitmap/list.c2
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)
indent += SCROLLBAR_WIDTH;
}
+ display->set_viewport(list_text_vp);
for (i=start; i<end && i<list->nb_items; i++)
{
/* do the text */
@@ -246,7 +247,6 @@ void list_draw(struct screen *display, struct gui_synclist *list)
}
line_indent += indent;
- display->set_viewport(list_text_vp);
/* position the string at the correct offset place */
int item_width,h;
display->getstringsize(entry_name, &item_width, &h);