1
0
Fork 0
forked from len0rd/rockbox

Colour targets: Adapted mandelbrot plugin. The plugin library now contains scrolling routines for >= 8 bpp displays.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8578 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-02-05 12:59:10 +00:00
parent 1a03c37947
commit e49cade42d
3 changed files with 245 additions and 38 deletions

View file

@ -105,5 +105,119 @@ void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3)
}
}
#if LCD_DEPTH >= 8
/* FIXME: intermediate solution until we have properly optimised memmove() */
static void *my_memmove(void *dst0, const void *src0, size_t len0)
{
char *dst = (char *) dst0;
char *src = (char *) src0;
if (dst <= src)
{
while (len0--)
*dst++ = *src++;
}
else
{
dst += len0;
src += len0;
while (len0--)
*(--dst) = *(--src);
}
return dst0;
}
void xlcd_scroll_left(int count)
{
fb_data *data, *data_end;
int length, oldmode;
if ((unsigned)count >= LCD_WIDTH)
return;
data = local_rb->lcd_framebuffer;
data_end = data + LCD_WIDTH*LCD_HEIGHT;
length = LCD_WIDTH - count;
do
{
my_memmove(data, data + count, length * sizeof(fb_data));
data += LCD_WIDTH;
}
while (data < data_end);
oldmode = local_rb->lcd_get_drawmode();
local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
local_rb->lcd_fillrect(length, 0, count, LCD_HEIGHT);
local_rb->lcd_set_drawmode(oldmode);
}
void xlcd_scroll_right(int count)
{
fb_data *data, *data_end;
int length, oldmode;
if ((unsigned)count >= LCD_WIDTH)
return;
data = local_rb->lcd_framebuffer;
data_end = data + LCD_WIDTH*LCD_HEIGHT;
length = LCD_WIDTH - count;
do
{
my_memmove(data + count, data, length * sizeof(fb_data));
data += LCD_WIDTH;
}
while (data < data_end);
oldmode = local_rb->lcd_get_drawmode();
local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
local_rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
local_rb->lcd_set_drawmode(oldmode);
}
void xlcd_scroll_up(int count)
{
long length, oldmode;
if ((unsigned)count >= LCD_HEIGHT)
return;
length = LCD_HEIGHT - count;
my_memmove(local_rb->lcd_framebuffer,
local_rb->lcd_framebuffer + count * LCD_WIDTH,
length * LCD_WIDTH * sizeof(fb_data));
oldmode = local_rb->lcd_get_drawmode();
local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
local_rb->lcd_fillrect(0, length, LCD_WIDTH, count);
local_rb->lcd_set_drawmode(oldmode);
}
void xlcd_scroll_down(int count)
{
long length, oldmode;
if ((unsigned)count >= LCD_HEIGHT)
return;
length = LCD_HEIGHT - count;
my_memmove(local_rb->lcd_framebuffer + count * LCD_WIDTH,
local_rb->lcd_framebuffer,
length * LCD_WIDTH * sizeof(fb_data));
oldmode = local_rb->lcd_get_drawmode();
local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
local_rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
local_rb->lcd_set_drawmode(oldmode);
}
#endif /* LCD_DEPTH >= 8 */
#endif /* HAVE_LCD_BITMAP */

View file

@ -29,6 +29,11 @@
void xlcd_init(struct plugin_api* newrb);
void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3);
void xlcd_scroll_left(int count);
void xlcd_scroll_right(int count);
void xlcd_scroll_up(int count);
void xlcd_scroll_down(int count);
#endif /* HAVE_LCD_BITMAP */
#endif /* __XLCD_H__ */