diff options
author | Thomas Martitz <kugel@rockbox.org> | 2013-04-03 16:33:23 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2013-12-14 23:11:30 +0100 |
commit | 1c5d0b41eebdb4f8c627b1a0e5f7b699f0b08fb8 (patch) | |
tree | 3ec44a4e6cfe4bfaab689e765ef3546d8dac730d /firmware | |
parent | 47c8d3c14d8fdaf4749ef5e0380fb0c52140b5fb (diff) | |
download | rockbox-1c5d0b41eebdb4f8c627b1a0e5f7b699f0b08fb8.tar.gz rockbox-1c5d0b41eebdb4f8c627b1a0e5f7b699f0b08fb8.zip |
scroll_engine: Rename scroll_stop* functions to be more consistent with the lcd api.
Change-Id: I8ada10b96bfb628cca0331689e8b936ae47c7e1c
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd-16bit-common.c | 8 | ||||
-rw-r--r-- | firmware/drivers/lcd-1bit-vert.c | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-bitmap-common.c | 10 | ||||
-rw-r--r-- | firmware/drivers/lcd-charcell.c | 6 | ||||
-rw-r--r-- | firmware/export/lcd-remote.h | 3 | ||||
-rw-r--r-- | firmware/export/lcd.h | 4 | ||||
-rw-r--r-- | firmware/export/scroll_engine.h | 24 | ||||
-rw-r--r-- | firmware/rolo.c | 2 | ||||
-rw-r--r-- | firmware/scroll_engine.c | 36 |
9 files changed, 53 insertions, 42 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index f8673ec6db..dffc1cf075 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c | |||
@@ -144,13 +144,9 @@ void lcd_clear_viewport(void) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | if (current_vp == &default_vp) | 146 | if (current_vp == &default_vp) |
147 | { | 147 | lcd_scroll_stop(); |
148 | lcd_scroll_info.lines = 0; | ||
149 | } | ||
150 | else | 148 | else |
151 | { | 149 | lcd_scroll_stop_viewport(current_vp); |
152 | lcd_scroll_stop(current_vp); | ||
153 | } | ||
154 | } | 150 | } |
155 | 151 | ||
156 | /*** parameter handling ***/ | 152 | /*** parameter handling ***/ |
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index 5cacf0a740..668c685187 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c | |||
@@ -226,7 +226,7 @@ void LCDFN(clear_viewport)(void) | |||
226 | 226 | ||
227 | current_vp->drawmode = oldmode; | 227 | current_vp->drawmode = oldmode; |
228 | 228 | ||
229 | LCDFN(scroll_stop)(current_vp); | 229 | LCDFN(scroll_stop_viewport)(current_vp); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index a17ac51006..10a567edf1 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c | |||
@@ -178,6 +178,12 @@ void LCDFN(set_viewport)(struct viewport* vp) | |||
178 | #endif | 178 | #endif |
179 | } | 179 | } |
180 | 180 | ||
181 | struct viewport *LCDFN(get_viewport)(bool *is_default) | ||
182 | { | ||
183 | *is_default = (current_vp == &default_vp); | ||
184 | return current_vp; | ||
185 | } | ||
186 | |||
181 | void LCDFN(update_viewport)(void) | 187 | void LCDFN(update_viewport)(void) |
182 | { | 188 | { |
183 | LCDFN(update_rect)(current_vp->x, current_vp->y, | 189 | LCDFN(update_rect)(current_vp->x, current_vp->y, |
@@ -405,7 +411,7 @@ void LCDFN(puts_style_xyoffset)(int x, int y, const unsigned char *str, | |||
405 | int style, int x_offset, int y_offset) | 411 | int style, int x_offset, int y_offset) |
406 | { | 412 | { |
407 | int xpos, ypos, h; | 413 | int xpos, ypos, h; |
408 | LCDFN(scroll_stop_line)(current_vp, y); | 414 | LCDFN(scroll_stop_viewport_line)(current_vp, y); |
409 | if(!str) | 415 | if(!str) |
410 | return; | 416 | return; |
411 | 417 | ||
@@ -491,7 +497,7 @@ void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string | |||
491 | if (restart) | 497 | if (restart) |
492 | { | 498 | { |
493 | /* remove any previously scrolling line at the same location */ | 499 | /* remove any previously scrolling line at the same location */ |
494 | LCDFN(scroll_stop_line)(current_vp, y); | 500 | LCDFN(scroll_stop_viewport_line)(current_vp, y); |
495 | 501 | ||
496 | if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return; | 502 | if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return; |
497 | LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset); | 503 | LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset); |
diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c index b59b270f9b..bdd02de1b6 100644 --- a/firmware/drivers/lcd-charcell.c +++ b/firmware/drivers/lcd-charcell.c | |||
@@ -377,7 +377,7 @@ void lcd_clear_viewport(void) | |||
377 | for (y = 0; y < current_vp->height; y++) | 377 | for (y = 0; y < current_vp->height; y++) |
378 | lcd_putxchar(x, y, xspace); | 378 | lcd_putxchar(x, y, xspace); |
379 | 379 | ||
380 | lcd_scroll_stop(current_vp); | 380 | lcd_scroll_stop_viewport(current_vp); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
@@ -486,7 +486,7 @@ void lcd_puts_offset(int x, int y, const unsigned char *str, int offset) | |||
486 | return; | 486 | return; |
487 | 487 | ||
488 | /* make sure scrolling is turned off on the line we are updating */ | 488 | /* make sure scrolling is turned off on the line we are updating */ |
489 | lcd_scroll_stop_line(current_vp, y); | 489 | lcd_scroll_stop_viewport_line(current_vp, y); |
490 | 490 | ||
491 | x = lcd_putsxyofs(x, y, offset, str); | 491 | x = lcd_putsxyofs(x, y, offset, str); |
492 | while (x < current_vp->width) | 492 | while (x < current_vp->width) |
@@ -509,7 +509,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, | |||
509 | return; | 509 | return; |
510 | 510 | ||
511 | /* remove any previously scrolling line at the same location */ | 511 | /* remove any previously scrolling line at the same location */ |
512 | lcd_scroll_stop_line(current_vp, y); | 512 | lcd_scroll_stop_viewport_line(current_vp, y); |
513 | 513 | ||
514 | if (lcd_scroll_info.lines >= LCD_SCROLLABLE_LINES) return; | 514 | if (lcd_scroll_info.lines >= LCD_SCROLLABLE_LINES) return; |
515 | 515 | ||
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index 6a3371fef2..74b668db3d 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h | |||
@@ -187,9 +187,6 @@ extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, | |||
187 | extern void lcd_remote_puts_style_xyoffset(int x, int y, const unsigned char *str, | 187 | extern void lcd_remote_puts_style_xyoffset(int x, int y, const unsigned char *str, |
188 | int style, int x_offset, int y_offset); | 188 | int style, int x_offset, int y_offset); |
189 | extern void lcd_remote_putc(int x, int y, unsigned short ch); | 189 | extern void lcd_remote_putc(int x, int y, unsigned short ch); |
190 | extern void lcd_remote_stop_scroll(void); | ||
191 | extern void lcd_remote_scroll_speed(int speed); | ||
192 | extern void lcd_remote_scroll_delay(int ms); | ||
193 | extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str); | 190 | extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str); |
194 | extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str, | 191 | extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str, |
195 | int style); | 192 | int style); |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 5ad2d83513..7ea053f241 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -207,10 +207,6 @@ extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); | |||
207 | extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, | 207 | extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, |
208 | int offset); | 208 | int offset); |
209 | extern void lcd_putc(int x, int y, unsigned long ucs); | 209 | extern void lcd_putc(int x, int y, unsigned long ucs); |
210 | extern void lcd_stop_scroll(void); | ||
211 | extern void lcd_bidir_scroll(int threshold); | ||
212 | extern void lcd_scroll_speed(int speed); | ||
213 | extern void lcd_scroll_delay(int ms); | ||
214 | extern void lcd_puts_scroll(int x, int y, const unsigned char* string); | 210 | extern void lcd_puts_scroll(int x, int y, const unsigned char* string); |
215 | extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string, | 211 | extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string, |
216 | int style); | 212 | int style); |
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h index 55f4120893..01a9a5e33d 100644 --- a/firmware/export/scroll_engine.h +++ b/firmware/export/scroll_engine.h | |||
@@ -29,14 +29,24 @@ | |||
29 | #include <lcd.h> | 29 | #include <lcd.h> |
30 | #include "file.h" | 30 | #include "file.h" |
31 | 31 | ||
32 | void scroll_init(void) INIT_ATTR; | 32 | extern void scroll_init(void) INIT_ATTR; |
33 | void lcd_scroll_stop(const struct viewport* vp); | 33 | |
34 | void lcd_scroll_stop_line(const struct viewport* vp, int y); | 34 | extern void lcd_bidir_scroll(int threshold); |
35 | void lcd_scroll_fn(void); | 35 | extern void lcd_scroll_speed(int speed); |
36 | extern void lcd_scroll_delay(int ms); | ||
37 | |||
38 | extern void lcd_scroll_stop(void); | ||
39 | extern void lcd_scroll_stop_viewport(const struct viewport *vp); | ||
40 | extern void lcd_scroll_stop_viewport_line(const struct viewport *vp, int line); | ||
41 | extern void lcd_scroll_fn(void); | ||
36 | #ifdef HAVE_REMOTE_LCD | 42 | #ifdef HAVE_REMOTE_LCD |
37 | void lcd_remote_scroll_fn(void); | 43 | extern void lcd_remote_scroll_speed(int speed); |
38 | void lcd_remote_scroll_stop(const struct viewport* vp); | 44 | extern void lcd_remote_scroll_delay(int ms); |
39 | void lcd_remote_scroll_stop_line(const struct viewport* vp, int y); | 45 | |
46 | extern void lcd_remote_scroll_stop(void); | ||
47 | extern void lcd_remote_scroll_stop_viewport(const struct viewport *vp); | ||
48 | extern void lcd_remote_scroll_stop_viewport_line(const struct viewport *vp, int line); | ||
49 | extern void lcd_remote_scroll_fn(void); | ||
40 | #endif | 50 | #endif |
41 | 51 | ||
42 | /* internal usage, but in multiple drivers */ | 52 | /* internal usage, but in multiple drivers */ |
diff --git a/firmware/rolo.c b/firmware/rolo.c index 325e17e97f..79969bbbcf 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c | |||
@@ -115,7 +115,7 @@ static void rolo_error(const char *text) | |||
115 | button_get(true); | 115 | button_get(true); |
116 | button_get(true); | 116 | button_get(true); |
117 | button_get(true); | 117 | button_get(true); |
118 | lcd_stop_scroll(); | 118 | lcd_scroll_stop(); |
119 | } | 119 | } |
120 | 120 | ||
121 | #if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX | 121 | #if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX |
diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c index bc356a8281..82af26afa8 100644 --- a/firmware/scroll_engine.c +++ b/firmware/scroll_engine.c | |||
@@ -41,6 +41,10 @@ static const char scroll_tick_table[18] = { | |||
41 | 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1 | 41 | 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1 |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /* imported private functions from lcd-bitmap-common.c */ | ||
45 | extern struct viewport *lcd_get_viewport(void); | ||
46 | extern struct viewport *lcd_remote_get_viewport(void); | ||
47 | |||
44 | static void scroll_thread(void); | 48 | static void scroll_thread(void); |
45 | static char scroll_stack[DEFAULT_STACK_SIZE*3]; | 49 | static char scroll_stack[DEFAULT_STACK_SIZE*3]; |
46 | static const char scroll_name[] = "scroll"; | 50 | static const char scroll_name[] = "scroll"; |
@@ -80,20 +84,21 @@ struct scroll_screen_info lcd_remote_scroll_info = | |||
80 | }; | 84 | }; |
81 | #endif /* HAVE_REMOTE_LCD */ | 85 | #endif /* HAVE_REMOTE_LCD */ |
82 | 86 | ||
83 | void lcd_stop_scroll(void) | 87 | void lcd_scroll_stop(void) |
84 | { | 88 | { |
85 | lcd_scroll_info.lines = 0; | 89 | lcd_scroll_info.lines = 0; |
86 | } | 90 | } |
87 | 91 | ||
88 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ | 92 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ |
89 | void lcd_scroll_stop_line(const struct viewport* current_vp, int y) | 93 | void lcd_scroll_stop_viewport_line(const struct viewport *current_vp, int line) |
90 | { | 94 | { |
91 | int i = 0; | 95 | int i = 0; |
92 | 96 | ||
93 | while (i < lcd_scroll_info.lines) | 97 | while (i < lcd_scroll_info.lines) |
94 | { | 98 | { |
95 | if ((lcd_scroll_info.scroll[i].vp == current_vp) && | 99 | struct viewport *vp = lcd_scroll_info.scroll[i].vp; |
96 | ((y < 0) || (lcd_scroll_info.scroll[i].y == y))) | 100 | if (((vp == current_vp)) && |
101 | ((line < 0) || (lcd_scroll_info.scroll[i].y == line))) | ||
97 | { | 102 | { |
98 | /* If i is not the last active line in the array, then move | 103 | /* If i is not the last active line in the array, then move |
99 | the last item to position i */ | 104 | the last item to position i */ |
@@ -106,7 +111,7 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y) | |||
106 | 111 | ||
107 | /* A line can only appear once, so we're done, | 112 | /* A line can only appear once, so we're done, |
108 | * unless we are clearing the whole viewport */ | 113 | * unless we are clearing the whole viewport */ |
109 | if (y >= 0) | 114 | if (line >= 0) |
110 | return ; | 115 | return ; |
111 | } | 116 | } |
112 | else | 117 | else |
@@ -117,9 +122,9 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y) | |||
117 | } | 122 | } |
118 | 123 | ||
119 | /* Stop all scrolling lines in the specified viewport */ | 124 | /* Stop all scrolling lines in the specified viewport */ |
120 | void lcd_scroll_stop(const struct viewport* vp) | 125 | void lcd_scroll_stop_viewport(const struct viewport *current_vp) |
121 | { | 126 | { |
122 | lcd_scroll_stop_line(vp, -1); | 127 | lcd_scroll_stop_viewport_line(current_vp, -1); |
123 | } | 128 | } |
124 | 129 | ||
125 | void lcd_scroll_speed(int speed) | 130 | void lcd_scroll_speed(int speed) |
@@ -157,20 +162,21 @@ void lcd_jump_scroll_delay(int ms) | |||
157 | #endif | 162 | #endif |
158 | 163 | ||
159 | #ifdef HAVE_REMOTE_LCD | 164 | #ifdef HAVE_REMOTE_LCD |
160 | void lcd_remote_stop_scroll(void) | 165 | void lcd_remote_scroll_stop(void) |
161 | { | 166 | { |
162 | lcd_remote_scroll_info.lines = 0; | 167 | lcd_remote_scroll_info.lines = 0; |
163 | } | 168 | } |
164 | 169 | ||
165 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ | 170 | /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ |
166 | void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) | 171 | void lcd_remote_scroll_stop_viewport_line(const struct viewport *current_vp, int line) |
167 | { | 172 | { |
168 | int i = 0; | 173 | int i = 0; |
169 | 174 | ||
170 | while (i < lcd_remote_scroll_info.lines) | 175 | while (i < lcd_scroll_info.lines) |
171 | { | 176 | { |
172 | if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) && | 177 | struct viewport *vp = lcd_remote_scroll_info.scroll[i].vp; |
173 | ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y))) | 178 | if (((vp == current_vp)) && |
179 | ((line < 0) || (lcd_remote_scroll_info.scroll[i].y == line))) | ||
174 | { | 180 | { |
175 | /* If i is not the last active line in the array, then move | 181 | /* If i is not the last active line in the array, then move |
176 | the last item to position i */ | 182 | the last item to position i */ |
@@ -183,7 +189,7 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) | |||
183 | 189 | ||
184 | /* A line can only appear once, so we're done, | 190 | /* A line can only appear once, so we're done, |
185 | * unless we are clearing the whole viewport */ | 191 | * unless we are clearing the whole viewport */ |
186 | if (y >= 0) | 192 | if (line >= 0) |
187 | return ; | 193 | return ; |
188 | } | 194 | } |
189 | else | 195 | else |
@@ -194,9 +200,9 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) | |||
194 | } | 200 | } |
195 | 201 | ||
196 | /* Stop all scrolling lines in the specified viewport */ | 202 | /* Stop all scrolling lines in the specified viewport */ |
197 | void lcd_remote_scroll_stop(const struct viewport* vp) | 203 | void lcd_remote_scroll_stop_viewport(const struct viewport *current_vp) |
198 | { | 204 | { |
199 | lcd_remote_scroll_stop_line(vp, -1); | 205 | lcd_remote_scroll_stop_viewport_line(current_vp, -1); |
200 | } | 206 | } |
201 | 207 | ||
202 | void lcd_remote_scroll_speed(int speed) | 208 | void lcd_remote_scroll_speed(int speed) |