summaryrefslogtreecommitdiff
path: root/firmware/scroll_engine.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2013-01-31 07:24:19 +0100
committerThomas Martitz <kugel@rockbox.org>2013-12-14 23:11:31 +0100
commit50eb528bc1f9d2f7b7260eff8b85a5ed5b96e679 (patch)
tree47b53d62c0880a3ea6b9e761efdf0628855d13e0 /firmware/scroll_engine.c
parent26801b3bd8f11fe680146086aa0a2fd12e7de289 (diff)
downloadrockbox-50eb528bc1f9d2f7b7260eff8b85a5ed5b96e679.tar.gz
rockbox-50eb528bc1f9d2f7b7260eff8b85a5ed5b96e679.zip
scroll_engine: Major rework to support pixel-based scrolling and scroll callbacks.
Much of the scrolling work is moved from lcd-bitmap-common to lcd-scroll.c, a small scroll callback routine remains. This callback can potentially be overridden by more extensive scrollers. The callback also gets fed with pixel-based scrolling information, which finally removes the strict line-based nature of the scroll engine. Along with this is the change from scroll_stop_viewport_line() to scroll_stop_viewport_rect() which works on a pixel-based rectangle instead of lines. The ultimate goal is to move most of the scroll work to apps, which can much better decide which line decorations to apply etc. This work is laying the ground work. Change-Id: I3b2885cf7d8696ddd9253d5a9a73318d3d42831a
Diffstat (limited to 'firmware/scroll_engine.c')
-rw-r--r--firmware/scroll_engine.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c
index d134f7b2ce..d1bc2976a1 100644
--- a/firmware/scroll_engine.c
+++ b/firmware/scroll_engine.c
@@ -23,6 +23,7 @@
23 * 23 *
24 ****************************************************************************/ 24 ****************************************************************************/
25 25
26#include <stdio.h>
26#include "config.h" 27#include "config.h"
27#include "gcc_extensions.h" 28#include "gcc_extensions.h"
28#include "cpu.h" 29#include "cpu.h"
@@ -36,16 +37,20 @@
36#endif 37#endif
37#include "scroll_engine.h" 38#include "scroll_engine.h"
38 39
40
41/* private helper function for the scroll engine. Do not use in apps/.
42 * defined in lcd-bitmap-common.c */
43extern struct viewport *lcd_get_viewport(bool *is_defaut);
44#ifdef HAVE_REMOTE_LCD
45extern struct viewport *lcd_remote_get_viewport(bool *is_defaut);
46#endif
47
39static const char scroll_tick_table[18] = { 48static const char scroll_tick_table[18] = {
40 /* Hz values [f(x)=100.8/(x+.048)]: 49 /* Hz values [f(x)=100.8/(x+.048)]:
41 1, 1.25, 1.55, 2, 2.5, 3.12, 4, 5, 6.25, 8.33, 10, 12.5, 16.7, 20, 25, 33, 49.2, 96.2 */ 50 1, 1.25, 1.55, 2, 2.5, 3.12, 4, 5, 6.25, 8.33, 10, 12.5, 16.7, 20, 25, 33, 49.2, 96.2 */
42 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1 51 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1
43}; 52};
44 53
45/* imported private functions from lcd-bitmap-common.c */
46extern struct viewport *lcd_get_viewport(void);
47extern struct viewport *lcd_remote_get_viewport(void);
48
49static void scroll_thread(void); 54static void scroll_thread(void);
50static char scroll_stack[DEFAULT_STACK_SIZE*3]; 55static char scroll_stack[DEFAULT_STACK_SIZE*3];
51static const char scroll_name[] = "scroll"; 56static const char scroll_name[] = "scroll";
@@ -156,7 +161,7 @@ static void scroll_thread(void)
156#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 161#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
157 if (lcd_active()) 162 if (lcd_active())
158#endif 163#endif
159 lcd_scroll_fn(); 164 lcd_scroll_worker();
160 lcd_scroll_info.last_scroll = current_tick; 165 lcd_scroll_info.last_scroll = current_tick;
161 } 166 }
162 167
@@ -165,7 +170,7 @@ static void scroll_thread(void)
165 170
166 if (scroll & SCROLL_LCD_REMOTE) 171 if (scroll & SCROLL_LCD_REMOTE)
167 { 172 {
168 lcd_remote_scroll_fn(); 173 lcd_remote_scroll_worker();
169 lcd_remote_scroll_info.last_scroll = current_tick; 174 lcd_remote_scroll_info.last_scroll = current_tick;
170 } 175 }
171 } 176 }
@@ -179,7 +184,7 @@ static void scroll_thread(void)
179#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 184#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
180 if (lcd_active()) 185 if (lcd_active())
181#endif 186#endif
182 lcd_scroll_fn(); 187 lcd_scroll_worker();
183 } 188 }
184} 189}
185#endif /* HAVE_REMOTE_LCD */ 190#endif /* HAVE_REMOTE_LCD */