From 512be370c66bc61ab58bc19971fe9cfb93c031c7 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sat, 12 Dec 2020 01:11:46 +0100 Subject: 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 --- apps/gui/bitmap/list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; inb_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); -- cgit v1.2.3