1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2013-01-31 07:24:19 +01:00
parent 26801b3bd8
commit 50eb528bc1
7 changed files with 202 additions and 155 deletions

View file

@ -23,6 +23,7 @@
*
****************************************************************************/
#include <stdio.h>
#include "config.h"
#include "gcc_extensions.h"
#include "cpu.h"
@ -36,16 +37,20 @@
#endif
#include "scroll_engine.h"
/* private helper function for the scroll engine. Do not use in apps/.
* defined in lcd-bitmap-common.c */
extern struct viewport *lcd_get_viewport(bool *is_defaut);
#ifdef HAVE_REMOTE_LCD
extern struct viewport *lcd_remote_get_viewport(bool *is_defaut);
#endif
static const char scroll_tick_table[18] = {
/* Hz values [f(x)=100.8/(x+.048)]:
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 */
100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1
};
/* imported private functions from lcd-bitmap-common.c */
extern struct viewport *lcd_get_viewport(void);
extern struct viewport *lcd_remote_get_viewport(void);
static void scroll_thread(void);
static char scroll_stack[DEFAULT_STACK_SIZE*3];
static const char scroll_name[] = "scroll";
@ -156,7 +161,7 @@ static void scroll_thread(void)
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
if (lcd_active())
#endif
lcd_scroll_fn();
lcd_scroll_worker();
lcd_scroll_info.last_scroll = current_tick;
}
@ -165,7 +170,7 @@ static void scroll_thread(void)
if (scroll & SCROLL_LCD_REMOTE)
{
lcd_remote_scroll_fn();
lcd_remote_scroll_worker();
lcd_remote_scroll_info.last_scroll = current_tick;
}
}
@ -179,7 +184,7 @@ static void scroll_thread(void)
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
if (lcd_active())
#endif
lcd_scroll_fn();
lcd_scroll_worker();
}
}
#endif /* HAVE_REMOTE_LCD */