diff options
author | Dave Chapman <dave@dchapman.com> | 2008-01-07 20:34:11 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-01-07 20:34:11 +0000 |
commit | 945c8a221ade41c462a93f8452320a806e5645b3 (patch) | |
tree | 2a17823e286e6252e60c44c7f4753d5c18ef5172 /firmware/scroll_engine.c | |
parent | 2a8f39820b49f116820356c2ca224f82f2106c21 (diff) | |
download | rockbox-945c8a221ade41c462a93f8452320a806e5645b3.tar.gz 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.c | 68 |
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) | |||
82 | lcd_scroll_info.lines = 0; | 82 | lcd_scroll_info.lines = 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ | ||
86 | void lcd_scroll_stop_line(struct viewport* current_vp, int y) | ||
87 | { | ||
88 | int i = 0; | ||
89 | |||
90 | while (i < lcd_scroll_info.lines) | ||
91 | { | ||
92 | if ((lcd_scroll_info.scroll[i].vp == current_vp) && | ||
93 | ((y < 0) || (lcd_scroll_info.scroll[i].y == y))) | ||
94 | { | ||
95 | /* If i is not the last active line in the array, then move | ||
96 | the last item to position i */ | ||
97 | if ((i + 1) != lcd_scroll_info.lines) | ||
98 | { | ||
99 | lcd_scroll_info.scroll[i] = lcd_scroll_info.scroll[lcd_scroll_info.lines-1]; | ||
100 | } | ||
101 | lcd_scroll_info.lines--; | ||
102 | |||
103 | /* A line can only appear once, so we're done. */ | ||
104 | return ; | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | i++; | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | /* Stop all scrolling lines in the specified viewport */ | ||
114 | void lcd_scroll_stop(struct viewport* vp) | ||
115 | { | ||
116 | lcd_scroll_stop_line(vp, -1); | ||
117 | } | ||
118 | |||
85 | void lcd_scroll_speed(int speed) | 119 | void lcd_scroll_speed(int speed) |
86 | { | 120 | { |
87 | lcd_scroll_info.ticks = scroll_tick_table[speed]; | 121 | lcd_scroll_info.ticks = scroll_tick_table[speed]; |
@@ -122,6 +156,40 @@ void lcd_remote_stop_scroll(void) | |||
122 | lcd_remote_scroll_info.lines = 0; | 156 | lcd_remote_scroll_info.lines = 0; |
123 | } | 157 | } |
124 | 158 | ||
159 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ | ||
160 | void lcd_remote_scroll_stop_line(struct viewport* current_vp, int y) | ||
161 | { | ||
162 | int i = 0; | ||
163 | |||
164 | while (i < lcd_remote_scroll_info.lines) | ||
165 | { | ||
166 | if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) && | ||
167 | ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y))) | ||
168 | { | ||
169 | /* If i is not the last active line in the array, then move | ||
170 | the last item to position i */ | ||
171 | if ((i + 1) != lcd_remote_scroll_info.lines) | ||
172 | { | ||
173 | lcd_remote_scroll_info.scroll[i] = lcd_remote_scroll_info.scroll[lcd_remote_scroll_info.lines-1]; | ||
174 | } | ||
175 | lcd_remote_scroll_info.lines--; | ||
176 | |||
177 | /* A line can only appear once, so we're done. */ | ||
178 | return ; | ||
179 | } | ||
180 | else | ||
181 | { | ||
182 | i++; | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | |||
187 | /* Stop all scrolling lines in the specified viewport */ | ||
188 | void lcd_remote_scroll_stop(struct viewport* vp) | ||
189 | { | ||
190 | lcd_remote_scroll_stop_line(vp, -1); | ||
191 | } | ||
192 | |||
125 | void lcd_remote_scroll_speed(int speed) | 193 | void lcd_remote_scroll_speed(int speed) |
126 | { | 194 | { |
127 | lcd_remote_scroll_info.ticks = scroll_tick_table[speed]; | 195 | lcd_remote_scroll_info.ticks = scroll_tick_table[speed]; |