2006-03-08 01:14:46 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Additional LCD routines not present in the rockbox core
|
|
|
|
* Scrolling functions
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Jens Arnold
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-03-08 01:14:46 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "plugin.h"
|
|
|
|
|
|
|
|
#include "xlcd.h"
|
|
|
|
|
2008-03-23 00:28:16 +00:00
|
|
|
#if (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
|
|
|
|
static const unsigned short patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
|
|
|
|
#endif
|
|
|
|
|
2022-09-30 09:25:28 +00:00
|
|
|
#if LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
2009-09-12 16:42:11 +00:00
|
|
|
void xlcd_scroll_left(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
|
|
|
|
2009-09-12 16:42:11 +00:00
|
|
|
int length, oldmode;
|
|
|
|
|
|
|
|
if ((unsigned)count >= LCD_WIDTH)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2009-09-12 16:42:11 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2009-09-12 16:42:11 +00:00
|
|
|
|
|
|
|
length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
|
|
|
|
|
2020-10-07 06:01:35 +00:00
|
|
|
rb->memmove(lcd_fb, lcd_fb + LCD_HEIGHT*count, length * sizeof(fb_data));
|
2009-09-12 16:42:11 +00:00
|
|
|
|
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(LCD_WIDTH-count, 0, count, LCD_HEIGHT);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Scroll right */
|
|
|
|
void xlcd_scroll_right(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
|
|
|
|
2009-09-12 16:42:11 +00:00
|
|
|
int length, oldmode;
|
|
|
|
|
|
|
|
if ((unsigned)count >= LCD_WIDTH)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2009-09-12 16:42:11 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2009-09-12 16:42:11 +00:00
|
|
|
|
|
|
|
length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
|
|
|
|
|
2020-10-26 16:38:22 +00:00
|
|
|
rb->memmove(lcd_fb + LCD_HEIGHT*count,
|
2020-10-07 06:01:35 +00:00
|
|
|
lcd_fb, length * sizeof(fb_data));
|
2009-09-12 16:42:11 +00:00
|
|
|
|
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Scroll up */
|
|
|
|
void xlcd_scroll_up(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
|
|
|
|
2009-09-12 16:42:11 +00:00
|
|
|
int width, length, oldmode;
|
2020-10-26 16:38:22 +00:00
|
|
|
|
2009-09-12 16:42:11 +00:00
|
|
|
fb_data *data;
|
|
|
|
|
|
|
|
if ((unsigned)count >= LCD_HEIGHT)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2009-09-12 16:42:11 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2009-09-12 16:42:11 +00:00
|
|
|
|
|
|
|
length = LCD_HEIGHT - count;
|
2020-10-26 16:38:22 +00:00
|
|
|
|
2009-10-08 03:56:37 +00:00
|
|
|
width = LCD_WIDTH-1;
|
2020-10-07 06:01:35 +00:00
|
|
|
data = lcd_fb;
|
2020-10-26 16:38:22 +00:00
|
|
|
|
2009-09-12 16:42:11 +00:00
|
|
|
do {
|
|
|
|
rb->memmove(data,data + count,length * sizeof(fb_data));
|
|
|
|
data += LCD_HEIGHT;
|
|
|
|
} while(width--);
|
|
|
|
|
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, length, LCD_WIDTH, count);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Scroll down */
|
|
|
|
void xlcd_scroll_down(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
|
|
|
|
2009-09-12 16:42:11 +00:00
|
|
|
int width, length, oldmode;
|
2020-10-26 16:38:22 +00:00
|
|
|
|
2009-09-12 16:42:11 +00:00
|
|
|
fb_data *data;
|
|
|
|
|
|
|
|
if ((unsigned)count >= LCD_HEIGHT)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2009-09-12 16:42:11 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2009-09-12 16:42:11 +00:00
|
|
|
|
|
|
|
length = LCD_HEIGHT - count;
|
|
|
|
|
2009-10-08 03:56:37 +00:00
|
|
|
width = LCD_WIDTH-1;
|
2020-10-07 06:01:35 +00:00
|
|
|
data = lcd_fb;
|
2020-10-26 16:38:22 +00:00
|
|
|
|
2009-09-12 16:42:11 +00:00
|
|
|
do {
|
|
|
|
rb->memmove(data + count, data, length * sizeof(fb_data));
|
|
|
|
data += LCD_HEIGHT;
|
|
|
|
} while(width--);
|
|
|
|
|
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
#if (LCD_PIXELFORMAT == HORIZONTAL_PACKING) && (LCD_DEPTH < 8)
|
|
|
|
|
|
|
|
/* Scroll left */
|
|
|
|
void xlcd_scroll_left(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
|
|
|
|
2011-08-25 19:34:15 +00:00
|
|
|
int bitcount=0, oldmode;
|
|
|
|
int blockcount=0, blocklen;
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
if ((unsigned) count >= LCD_WIDTH)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2006-03-08 01:14:46 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2011-08-25 19:34:15 +00:00
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
#if LCD_DEPTH == 2
|
|
|
|
blockcount = count >> 2;
|
|
|
|
blocklen = LCD_FBWIDTH - blockcount;
|
|
|
|
bitcount = 2 * (count & 3);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (blockcount)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
unsigned char *data = lcd_fb;
|
2006-03-08 01:14:46 +00:00
|
|
|
unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2009-01-16 10:34:40 +00:00
|
|
|
rb->memmove(data, data + blockcount, blocklen);
|
2006-03-08 01:14:46 +00:00
|
|
|
data += LCD_FBWIDTH;
|
|
|
|
}
|
|
|
|
while (data < data_end);
|
|
|
|
}
|
|
|
|
if (bitcount)
|
|
|
|
{
|
|
|
|
int bx, y;
|
2020-10-07 06:01:35 +00:00
|
|
|
unsigned char *addr = lcd_fb + blocklen;
|
2006-03-08 01:14:46 +00:00
|
|
|
#if LCD_DEPTH == 2
|
2009-11-22 14:48:50 +00:00
|
|
|
unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount;
|
2006-03-08 01:14:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
for (y = 0; y < LCD_HEIGHT; y++)
|
|
|
|
{
|
|
|
|
unsigned char *row_addr = addr;
|
|
|
|
unsigned data = fill;
|
|
|
|
|
|
|
|
for (bx = 0; bx < blocklen; bx++)
|
|
|
|
{
|
|
|
|
--row_addr;
|
2006-04-06 20:31:57 +00:00
|
|
|
data = (data >> 8) | (*row_addr << bitcount);
|
|
|
|
*row_addr = data;
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
addr += LCD_FBWIDTH;
|
|
|
|
}
|
|
|
|
}
|
2009-01-16 10:34:40 +00:00
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(LCD_WIDTH - count, 0, count, LCD_HEIGHT);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Scroll right */
|
|
|
|
void xlcd_scroll_right(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
|
|
|
|
2011-08-25 19:34:15 +00:00
|
|
|
int bitcount=0, oldmode;
|
|
|
|
int blockcount=0, blocklen;
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
if ((unsigned) count >= LCD_WIDTH)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2006-03-08 01:14:46 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2011-08-25 19:34:15 +00:00
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
#if LCD_DEPTH == 2
|
|
|
|
blockcount = count >> 2;
|
|
|
|
blocklen = LCD_FBWIDTH - blockcount;
|
|
|
|
bitcount = 2 * (count & 3);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (blockcount)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
unsigned char *data = lcd_fb;
|
2006-03-08 01:14:46 +00:00
|
|
|
unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2009-01-16 10:34:40 +00:00
|
|
|
rb->memmove(data + blockcount, data, blocklen);
|
2006-03-08 01:14:46 +00:00
|
|
|
data += LCD_FBWIDTH;
|
|
|
|
}
|
|
|
|
while (data < data_end);
|
|
|
|
}
|
|
|
|
if (bitcount)
|
|
|
|
{
|
|
|
|
int bx, y;
|
2020-10-07 06:01:35 +00:00
|
|
|
unsigned char *addr = lcd_fb + blockcount;
|
2006-03-08 01:14:46 +00:00
|
|
|
#if LCD_DEPTH == 2
|
2009-01-16 10:34:40 +00:00
|
|
|
unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
|
2006-03-08 01:14:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
for (y = 0; y < LCD_HEIGHT; y++)
|
|
|
|
{
|
|
|
|
unsigned char *row_addr = addr;
|
|
|
|
unsigned data = fill;
|
|
|
|
|
|
|
|
for (bx = 0; bx < blocklen; bx++)
|
|
|
|
{
|
2006-04-06 20:31:57 +00:00
|
|
|
data = (data << 8) | *row_addr;
|
|
|
|
*row_addr = data >> bitcount;
|
2006-03-08 01:14:46 +00:00
|
|
|
row_addr++;
|
|
|
|
}
|
|
|
|
addr += LCD_FBWIDTH;
|
|
|
|
}
|
|
|
|
}
|
2009-01-16 10:34:40 +00:00
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#else /* LCD_PIXELFORMAT vertical packed or >= 8bit / pixel */
|
|
|
|
|
|
|
|
/* Scroll left */
|
|
|
|
void xlcd_scroll_left(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
fb_data *data, *data_end;
|
|
|
|
int length, oldmode;
|
|
|
|
|
|
|
|
if ((unsigned)count >= LCD_WIDTH)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2006-03-08 01:14:46 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2006-03-08 01:14:46 +00:00
|
|
|
|
2020-10-07 06:01:35 +00:00
|
|
|
data = lcd_fb;
|
2008-03-23 00:28:16 +00:00
|
|
|
data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
|
2006-03-08 01:14:46 +00:00
|
|
|
length = LCD_WIDTH - count;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2009-01-16 10:34:40 +00:00
|
|
|
rb->memmove(data, data + count, length * sizeof(fb_data));
|
2006-03-08 01:14:46 +00:00
|
|
|
data += LCD_WIDTH;
|
|
|
|
}
|
|
|
|
while (data < data_end);
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(length, 0, count, LCD_HEIGHT);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Scroll right */
|
|
|
|
void xlcd_scroll_right(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
fb_data *data, *data_end;
|
|
|
|
int length, oldmode;
|
|
|
|
|
|
|
|
if ((unsigned)count >= LCD_WIDTH)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2006-03-08 01:14:46 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2006-03-08 01:14:46 +00:00
|
|
|
|
2020-10-07 06:01:35 +00:00
|
|
|
data = lcd_fb;
|
2008-03-23 00:28:16 +00:00
|
|
|
data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
|
2006-03-08 01:14:46 +00:00
|
|
|
length = LCD_WIDTH - count;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2009-01-16 10:34:40 +00:00
|
|
|
rb->memmove(data + count, data, length * sizeof(fb_data));
|
2006-03-08 01:14:46 +00:00
|
|
|
data += LCD_WIDTH;
|
|
|
|
}
|
|
|
|
while (data < data_end);
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* LCD_PIXELFORMAT, LCD_DEPTH */
|
|
|
|
|
|
|
|
#if (LCD_PIXELFORMAT == HORIZONTAL_PACKING) || (LCD_DEPTH >= 8)
|
|
|
|
|
|
|
|
/* Scroll up */
|
|
|
|
void xlcd_scroll_up(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
int length, oldmode;
|
|
|
|
|
|
|
|
if ((unsigned)count >= LCD_HEIGHT)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2006-03-08 01:14:46 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
length = LCD_HEIGHT - count;
|
|
|
|
|
2020-10-07 06:01:35 +00:00
|
|
|
rb->memmove(lcd_fb,
|
|
|
|
lcd_fb + count * LCD_FBWIDTH,
|
2006-03-08 01:14:46 +00:00
|
|
|
length * LCD_FBWIDTH * sizeof(fb_data));
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, length, LCD_WIDTH, count);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Scroll down */
|
|
|
|
void xlcd_scroll_down(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
int length, oldmode;
|
|
|
|
|
|
|
|
if ((unsigned)count >= LCD_HEIGHT)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2006-03-08 01:14:46 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
length = LCD_HEIGHT - count;
|
|
|
|
|
2020-10-07 06:01:35 +00:00
|
|
|
rb->memmove(lcd_fb + count * LCD_FBWIDTH,
|
|
|
|
lcd_fb,
|
2006-03-08 01:14:46 +00:00
|
|
|
length * LCD_FBWIDTH * sizeof(fb_data));
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 16:38:22 +00:00
|
|
|
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING,
|
2008-03-23 00:28:16 +00:00
|
|
|
LCD_PIXELFORMAT == VERTICAL_INTERLEAVED */
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
/* Scroll up */
|
|
|
|
void xlcd_scroll_up(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
2011-08-25 20:47:44 +00:00
|
|
|
int bitcount=0, oldmode;
|
|
|
|
int blockcount=0, blocklen;
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
if ((unsigned) count >= LCD_HEIGHT)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2006-03-08 01:14:46 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2020-10-26 16:38:22 +00:00
|
|
|
|
2008-03-23 00:28:16 +00:00
|
|
|
#if (LCD_DEPTH == 1) \
|
|
|
|
|| (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
|
2006-03-08 01:14:46 +00:00
|
|
|
blockcount = count >> 3;
|
|
|
|
bitcount = count & 7;
|
2008-03-23 00:28:16 +00:00
|
|
|
#elif (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_PACKING)
|
2006-03-08 01:14:46 +00:00
|
|
|
blockcount = count >> 2;
|
|
|
|
bitcount = 2 * (count & 3);
|
|
|
|
#endif
|
2008-03-23 00:28:16 +00:00
|
|
|
blocklen = LCD_FBHEIGHT - blockcount;
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
if (blockcount)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
rb->memmove(lcd_fb,
|
|
|
|
lcd_fb + blockcount * LCD_FBWIDTH,
|
2008-03-23 00:28:16 +00:00
|
|
|
blocklen * LCD_FBWIDTH * sizeof(fb_data));
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
if (bitcount)
|
|
|
|
{
|
2008-03-23 00:28:16 +00:00
|
|
|
#if LCD_PIXELFORMAT == VERTICAL_PACKING
|
|
|
|
|
2020-07-15 23:40:55 +00:00
|
|
|
#if defined(CPU_COLDFIRE) && (LCD_DEPTH == 2)
|
2006-03-08 01:14:46 +00:00
|
|
|
asm (
|
|
|
|
"move.l %[wide],%%d3\n" /* columns = width */
|
|
|
|
|
|
|
|
".su_cloop: \n" /* repeat for every column */
|
|
|
|
"move.l %[addr],%%a1\n" /* get start address */
|
|
|
|
"move.l %[rows],%%d2\n" /* rows = row_count */
|
|
|
|
"move.l %[bkg],%%d1 \n" /* fill with background */
|
|
|
|
|
|
|
|
".su_iloop: \n" /* repeat for all rows */
|
|
|
|
"sub.l %[wide],%%a1\n" /* address -= width */
|
|
|
|
|
|
|
|
"lsl.l #8,%%d1 \n" /* old data to 2nd byte */
|
2009-11-22 14:48:50 +00:00
|
|
|
"move.b (%%a1),%%d1 \n" /* combine with new data byte */
|
|
|
|
"move.l %%d1,%%d0 \n" /* keep data for next round */
|
2006-03-08 01:14:46 +00:00
|
|
|
"lsr.l %[cnt],%%d0 \n" /* shift right */
|
|
|
|
"move.b %%d0,(%%a1) \n" /* store data */
|
|
|
|
|
|
|
|
"subq.l #1,%%d2 \n" /* rows-- */
|
|
|
|
"bne.b .su_iloop \n"
|
|
|
|
|
|
|
|
"addq.l #1,%[addr] \n" /* start_address++ */
|
|
|
|
"subq.l #1,%%d3 \n" /* columns-- */
|
|
|
|
"bne.b .su_cloop \n"
|
|
|
|
: /* outputs */
|
|
|
|
: /* inputs */
|
|
|
|
[wide]"r"(LCD_FBWIDTH),
|
|
|
|
[rows]"r"(blocklen),
|
2020-10-07 06:01:35 +00:00
|
|
|
[addr]"a"(lcd_fb + blocklen * LCD_FBWIDTH),
|
2006-03-08 01:14:46 +00:00
|
|
|
[cnt] "d"(bitcount),
|
2009-01-16 10:34:40 +00:00
|
|
|
[bkg] "d"(0x55 * (~rb->lcd_get_background() & 3))
|
2006-03-08 01:14:46 +00:00
|
|
|
: /* clobbers */
|
|
|
|
"a1", "d0", "d1", "d2", "d3"
|
|
|
|
);
|
|
|
|
#else /* C version */
|
|
|
|
int x, by;
|
2020-10-07 06:01:35 +00:00
|
|
|
unsigned char *addr = lcd_fb + blocklen * LCD_FBWIDTH;
|
2006-03-08 01:14:46 +00:00
|
|
|
#if LCD_DEPTH == 2
|
2009-01-16 10:34:40 +00:00
|
|
|
unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
|
2008-03-23 00:28:16 +00:00
|
|
|
#else
|
|
|
|
const unsigned fill = 0;
|
2006-03-08 01:14:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
for (x = 0; x < LCD_WIDTH; x++)
|
|
|
|
{
|
|
|
|
unsigned char *col_addr = addr++;
|
|
|
|
unsigned data = fill;
|
2008-03-23 00:28:16 +00:00
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
for (by = 0; by < blocklen; by++)
|
|
|
|
{
|
|
|
|
col_addr -= LCD_FBWIDTH;
|
|
|
|
data = (data << 8) | *col_addr;
|
|
|
|
*col_addr = data >> bitcount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* CPU, LCD_DEPTH */
|
2008-03-23 00:28:16 +00:00
|
|
|
|
|
|
|
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
|
|
|
|
|
|
|
|
#if LCD_DEPTH == 2
|
|
|
|
int x, by;
|
2020-10-07 06:01:35 +00:00
|
|
|
fb_data *addr = lcd_fb + blocklen * LCD_FBWIDTH;
|
2008-03-23 00:28:16 +00:00
|
|
|
unsigned fill, mask;
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
fill = patterns[rb->lcd_get_background() & 3] << 8;
|
2008-03-23 00:28:16 +00:00
|
|
|
mask = (0xFFu >> bitcount) << bitcount;
|
|
|
|
mask |= mask << 8;
|
|
|
|
|
|
|
|
for (x = 0; x < LCD_WIDTH; x++)
|
|
|
|
{
|
|
|
|
fb_data *col_addr = addr++;
|
|
|
|
unsigned olddata = fill;
|
|
|
|
unsigned data;
|
|
|
|
|
|
|
|
for (by = 0; by < blocklen; by++)
|
|
|
|
{
|
|
|
|
col_addr -= LCD_FBWIDTH;
|
|
|
|
data = *col_addr;
|
|
|
|
*col_addr = (olddata ^ ((data ^ olddata) & mask)) >> bitcount;
|
|
|
|
olddata = data << 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* LCD_DEPTH == 2 */
|
|
|
|
|
|
|
|
#endif /* LCD_PIXELFORMAT */
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
2009-01-16 10:34:40 +00:00
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, LCD_HEIGHT - count, LCD_WIDTH, count);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Scroll up */
|
|
|
|
void xlcd_scroll_down(int count)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
/*size_t dst_stride;*/
|
|
|
|
/*struct viewport *vp_main = NULL;*/
|
|
|
|
fb_data *lcd_fb = get_framebuffer(NULL, NULL);
|
|
|
|
|
2011-08-25 20:47:44 +00:00
|
|
|
int bitcount=0, oldmode;
|
|
|
|
int blockcount=0, blocklen;
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
if ((unsigned) count >= LCD_HEIGHT)
|
2009-10-16 20:15:12 +00:00
|
|
|
{
|
|
|
|
rb->lcd_clear_display();
|
2006-03-08 01:14:46 +00:00
|
|
|
return;
|
2009-10-16 20:15:12 +00:00
|
|
|
}
|
2020-10-26 16:38:22 +00:00
|
|
|
|
2008-03-23 00:28:16 +00:00
|
|
|
#if (LCD_DEPTH == 1) \
|
|
|
|
|| (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
|
2006-03-08 01:14:46 +00:00
|
|
|
blockcount = count >> 3;
|
|
|
|
bitcount = count & 7;
|
2008-03-23 00:28:16 +00:00
|
|
|
#elif (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_PACKING)
|
2006-03-08 01:14:46 +00:00
|
|
|
blockcount = count >> 2;
|
|
|
|
bitcount = 2 * (count & 3);
|
|
|
|
#endif
|
2008-03-23 00:28:16 +00:00
|
|
|
blocklen = LCD_FBHEIGHT - blockcount;
|
2006-03-08 01:14:46 +00:00
|
|
|
|
|
|
|
if (blockcount)
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
rb->memmove(lcd_fb + blockcount * LCD_FBWIDTH,
|
|
|
|
lcd_fb,
|
2008-03-23 00:28:16 +00:00
|
|
|
blocklen * LCD_FBWIDTH * sizeof(fb_data));
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
if (bitcount)
|
|
|
|
{
|
2008-03-23 00:28:16 +00:00
|
|
|
#if LCD_PIXELFORMAT == VERTICAL_PACKING
|
|
|
|
|
2020-07-15 23:40:55 +00:00
|
|
|
#if defined(CPU_COLDFIRE) && (LCD_DEPTH == 2)
|
2006-03-08 01:14:46 +00:00
|
|
|
asm (
|
|
|
|
"move.l %[wide],%%d3\n" /* columns = width */
|
|
|
|
|
|
|
|
".sd_cloop: \n" /* repeat for every column */
|
|
|
|
"move.l %[addr],%%a1\n" /* get start address */
|
|
|
|
"move.l %[rows],%%d2\n" /* rows = row_count */
|
|
|
|
"move.l %[bkg],%%d1 \n" /* fill with background */
|
|
|
|
|
|
|
|
".sd_iloop: \n" /* repeat for all rows */
|
|
|
|
"lsr.l #8,%%d1 \n" /* shift right to get residue */
|
|
|
|
"clr.l %%d0 \n"
|
|
|
|
"move.b (%%a1),%%d0 \n" /* get data byte */
|
|
|
|
"lsl.l %[cnt],%%d0 \n"
|
|
|
|
"or.l %%d0,%%d1 \n" /* combine with last residue */
|
|
|
|
"move.b %%d1,(%%a1) \n" /* store data */
|
|
|
|
|
|
|
|
"add.l %[wide],%%a1\n" /* address += width */
|
|
|
|
"subq.l #1,%%d2 \n" /* rows-- */
|
|
|
|
"bne.b .sd_iloop \n"
|
|
|
|
|
|
|
|
"lea.l (1,%[addr]),%[addr] \n" /* start_address++ */
|
|
|
|
"subq.l #1,%%d3 \n" /* columns-- */
|
|
|
|
"bne.b .sd_cloop \n"
|
|
|
|
: /* outputs */
|
|
|
|
: /* inputs */
|
|
|
|
[wide]"r"(LCD_WIDTH),
|
|
|
|
[rows]"r"(blocklen),
|
2020-10-07 06:01:35 +00:00
|
|
|
[addr]"a"(lcd_fb + blockcount * LCD_FBWIDTH),
|
2006-03-08 01:14:46 +00:00
|
|
|
[cnt] "d"(bitcount),
|
2009-01-16 10:34:40 +00:00
|
|
|
[bkg] "d"((0x55 * (~rb->lcd_get_background() & 3)) << bitcount)
|
2006-03-08 01:14:46 +00:00
|
|
|
: /* clobbers */
|
|
|
|
"a1", "d0", "d1", "d2", "d3"
|
|
|
|
);
|
|
|
|
#else /* C version */
|
|
|
|
int x, by;
|
2020-10-07 06:01:35 +00:00
|
|
|
unsigned char *addr = lcd_fb + blockcount * LCD_FBWIDTH;
|
2006-03-08 01:14:46 +00:00
|
|
|
#if LCD_DEPTH == 2
|
2009-01-16 10:34:40 +00:00
|
|
|
unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount;
|
2008-03-23 00:28:16 +00:00
|
|
|
#else
|
|
|
|
const unsigned fill = 0;
|
2006-03-08 01:14:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
for (x = 0; x < LCD_WIDTH; x++)
|
|
|
|
{
|
|
|
|
unsigned char *col_addr = addr++;
|
|
|
|
unsigned data = fill;
|
2008-03-23 00:28:16 +00:00
|
|
|
|
2006-03-08 01:14:46 +00:00
|
|
|
for (by = 0; by < blocklen; by++)
|
|
|
|
{
|
|
|
|
data = (data >> 8) | (*col_addr << bitcount);
|
|
|
|
*col_addr = data;
|
|
|
|
col_addr += LCD_FBWIDTH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* CPU, LCD_DEPTH */
|
2008-03-23 00:28:16 +00:00
|
|
|
|
|
|
|
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
|
|
|
|
|
|
|
|
#if LCD_DEPTH == 2
|
|
|
|
int x, by;
|
2020-10-07 06:01:35 +00:00
|
|
|
fb_data *addr = lcd_fb + blockcount * LCD_FBWIDTH;
|
2008-03-23 00:28:16 +00:00
|
|
|
unsigned fill, mask;
|
2020-10-26 16:38:22 +00:00
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount);
|
2008-03-23 00:28:16 +00:00
|
|
|
mask = (0xFFu >> bitcount) << bitcount;
|
|
|
|
mask |= mask << 8;
|
|
|
|
|
|
|
|
for (x = 0; x < LCD_WIDTH; x++)
|
|
|
|
{
|
|
|
|
fb_data *col_addr = addr++;
|
|
|
|
unsigned olddata = fill;
|
|
|
|
unsigned data;
|
|
|
|
|
|
|
|
for (by = 0; by < blocklen; by++)
|
|
|
|
{
|
|
|
|
data = *col_addr << bitcount;
|
|
|
|
*col_addr = olddata ^ ((data ^ olddata) & mask);
|
|
|
|
olddata = data >> 8;
|
|
|
|
col_addr += LCD_FBWIDTH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* LCD_DEPTH == 2 */
|
|
|
|
|
|
|
|
#endif /* LCD_PIXELFORMAT */
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
2009-01-16 10:34:40 +00:00
|
|
|
oldmode = rb->lcd_get_drawmode();
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
|
|
|
|
rb->lcd_set_drawmode(oldmode);
|
2006-03-08 01:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* LCD_PIXELFORMAT, LCD_DEPTH */
|
2022-09-30 09:25:28 +00:00
|
|
|
#endif /* LCD_STRIDEFORMAT == VERTICAL_STRIDE */
|