summaryrefslogtreecommitdiffstats
path: root/firmware/scroll_engine.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-01-07 20:34:11 +0000
committerDave Chapman <dave@dchapman.com>2008-01-07 20:34:11 +0000
commit945c8a221ade41c462a93f8452320a806e5645b3 (patch)
tree2a17823e286e6252e60c44c7f4753d5c18ef5172 /firmware/scroll_engine.c
parent2a8f39820b49f116820356c2ca224f82f2106c21 (diff)
downloadrockbox-945c8a221ade41c462a93f8452320a806e5645b3.tar.gz
rockbox-945c8a221ade41c462a93f8452320a806e5645b3.tar.bz2
rockbox-945c8a221ade41c462a93f8452320a806e5645b3.zip
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
Diffstat (limited to 'firmware/scroll_engine.c')
-rw-r--r--firmware/scroll_engine.c68
1 files changed, 68 insertions, 0 deletions
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];