From 945c8a221ade41c462a93f8452320a806e5645b3 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Mon, 7 Jan 2008 20:34:11 +0000 Subject: Add viewport capabilities to all the LCD drivers, and adapt scrolling code. This is the firmware/ part of FS#8385 - the changes to the WPS code still need more work and will be committed at a later date. NOTE: There are no user-visible changes with this commit - just the infrastructure. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16018 a1c6a512-1295-4272-9138-f99709370657 --- firmware/scroll_engine.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'firmware/scroll_engine.c') diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c index 599e7f58b5..4783e9f1ef 100644 --- a/firmware/scroll_engine.c +++ b/firmware/scroll_engine.c @@ -82,6 +82,40 @@ void lcd_stop_scroll(void) lcd_scroll_info.lines = 0; } +/* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ +void lcd_scroll_stop_line(struct viewport* current_vp, int y) +{ + int i = 0; + + while (i < lcd_scroll_info.lines) + { + if ((lcd_scroll_info.scroll[i].vp == current_vp) && + ((y < 0) || (lcd_scroll_info.scroll[i].y == y))) + { + /* If i is not the last active line in the array, then move + the last item to position i */ + if ((i + 1) != lcd_scroll_info.lines) + { + lcd_scroll_info.scroll[i] = lcd_scroll_info.scroll[lcd_scroll_info.lines-1]; + } + lcd_scroll_info.lines--; + + /* A line can only appear once, so we're done. */ + return ; + } + else + { + i++; + } + } +} + +/* Stop all scrolling lines in the specified viewport */ +void lcd_scroll_stop(struct viewport* vp) +{ + lcd_scroll_stop_line(vp, -1); +} + void lcd_scroll_speed(int speed) { lcd_scroll_info.ticks = scroll_tick_table[speed]; @@ -122,6 +156,40 @@ void lcd_remote_stop_scroll(void) lcd_remote_scroll_info.lines = 0; } +/* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ +void lcd_remote_scroll_stop_line(struct viewport* current_vp, int y) +{ + int i = 0; + + while (i < lcd_remote_scroll_info.lines) + { + if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) && + ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y))) + { + /* If i is not the last active line in the array, then move + the last item to position i */ + if ((i + 1) != lcd_remote_scroll_info.lines) + { + lcd_remote_scroll_info.scroll[i] = lcd_remote_scroll_info.scroll[lcd_remote_scroll_info.lines-1]; + } + lcd_remote_scroll_info.lines--; + + /* A line can only appear once, so we're done. */ + return ; + } + else + { + i++; + } + } +} + +/* Stop all scrolling lines in the specified viewport */ +void lcd_remote_scroll_stop(struct viewport* vp) +{ + lcd_remote_scroll_stop_line(vp, -1); +} + void lcd_remote_scroll_speed(int speed) { lcd_remote_scroll_info.ticks = scroll_tick_table[speed]; -- cgit v1.2.3