forked from len0rd/rockbox
LCD drivers: * Slight speedup for 2bit greyscale drivers. Use the same scrolltext drawing anywhere. * Cleanup, fixes and definitions in preparation for X5 remote.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10346 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2d4cfa8738
commit
cb36fec392
9 changed files with 216 additions and 136 deletions
|
|
@ -34,7 +34,7 @@
|
|||
#include "rbunicode.h"
|
||||
#include "bidi.h"
|
||||
|
||||
#define SCROLLABLE_LINES 26
|
||||
#define SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32)
|
||||
|
||||
enum fill_opt {
|
||||
OPT_NONE = 0,
|
||||
|
|
@ -972,4 +972,3 @@ static void scroll_thread(void)
|
|||
sleep(scroll_ticks);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include "rbunicode.h"
|
||||
#include "bidi.h"
|
||||
|
||||
#define SCROLLABLE_LINES 26
|
||||
#define SCROLLABLE_LINES (((LCD_HEIGHT+4)/5 < 32) ? (LCD_HEIGHT+4)/5 : 32)
|
||||
|
||||
/*** globals ***/
|
||||
|
||||
|
|
@ -148,21 +148,28 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
|
|||
|
||||
static void setpixel(int x, int y)
|
||||
{
|
||||
unsigned char *data = &lcd_framebuffer[y][x>>2];
|
||||
unsigned mask = pixmask[x & 3];
|
||||
*data = (*data & ~mask) | (fg_pattern & mask);
|
||||
fb_data *address = &lcd_framebuffer[y][x>>2];
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ fg_pattern) & mask);
|
||||
}
|
||||
|
||||
static void clearpixel(int x, int y)
|
||||
{
|
||||
unsigned char *data = &lcd_framebuffer[y][x>>2];
|
||||
unsigned mask = pixmask[x & 3];
|
||||
*data = (*data & ~mask) | (bg_pattern & mask);
|
||||
fb_data *address = &lcd_framebuffer[y][x>>2];
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ bg_pattern) & mask);
|
||||
}
|
||||
|
||||
static void flippixel(int x, int y)
|
||||
{
|
||||
lcd_framebuffer[y][x>>2] ^= pixmask[x & 3];
|
||||
unsigned mask = pixmask[x & 3];
|
||||
fb_data *address = &lcd_framebuffer[y][x>>2];
|
||||
|
||||
*address ^= mask;
|
||||
}
|
||||
|
||||
static void nopixel(int x, int y)
|
||||
|
|
@ -177,34 +184,34 @@ lcd_pixelfunc_type* const lcd_pixelfuncs[8] = {
|
|||
};
|
||||
|
||||
/* 'mask' and 'bits' contain 2 bits per pixel */
|
||||
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address ^= bits & mask;
|
||||
}
|
||||
|
||||
static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bgblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bgblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ bg_pattern) & mask & ~bits);
|
||||
}
|
||||
|
||||
static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fgblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fgblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ fg_pattern) & mask & bits);
|
||||
}
|
||||
|
||||
static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
unsigned bgp = bg_pattern;
|
||||
|
|
@ -213,34 +220,34 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
|||
*address = data ^ ((data ^ bits) & mask);
|
||||
}
|
||||
|
||||
static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address ^= ~bits & mask;
|
||||
}
|
||||
|
||||
static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ bg_pattern) & mask & bits);
|
||||
}
|
||||
|
||||
static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ fg_pattern) & mask & ~bits);
|
||||
}
|
||||
|
||||
static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
unsigned fgp = fg_pattern;
|
||||
|
|
@ -254,7 +261,7 @@ lcd_blockfunc_type* const lcd_blockfuncs[8] = {
|
|||
flipinvblock, bginvblock, fginvblock, solidinvblock
|
||||
};
|
||||
|
||||
static inline void setblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
|
|
@ -510,11 +517,11 @@ void lcd_fillrect(int x, int y, int width, int height)
|
|||
/* About Rockbox' internal monochrome bitmap format:
|
||||
*
|
||||
* A bitmap contains one bit for every pixel that defines if that pixel is
|
||||
* black (1) or white (0). Bits within a byte are arranged horizontally, LSB
|
||||
* black (1) or white (0). Bits within a byte are arranged vertically, LSB
|
||||
* at top.
|
||||
* The bytes are stored in row-major order, with byte 0 being top left,
|
||||
* byte 1 2nd from left etc. The first row of bytes defines pixel row
|
||||
* 0, the second row defines pixel row 1 etc. */
|
||||
* byte 1 2nd from left etc. The first row of bytes defines pixel rows
|
||||
* 0..7, the second row defines pixel row 8..15 etc. */
|
||||
|
||||
/* Draw a partial monochrome bitmap */
|
||||
void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
||||
|
|
@ -937,15 +944,9 @@ static void scroll_thread(void)
|
|||
}
|
||||
|
||||
lastmode = drawmode;
|
||||
drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
||||
drawmode = DRMODE_SOLID;
|
||||
lcd_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line);
|
||||
if (s->invert)
|
||||
{
|
||||
drawmode = DRMODE_COMPLEMENT;
|
||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
||||
}
|
||||
drawmode = s->invert ?
|
||||
(DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
|
||||
lcd_putsxyofs(xpos, ypos, s->offset, s->line);
|
||||
drawmode = lastmode;
|
||||
lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@
|
|||
|
||||
/*** globals ***/
|
||||
|
||||
unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH]
|
||||
IBSS_ATTR;
|
||||
fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH]
|
||||
IBSS_ATTR;
|
||||
|
||||
static int drawmode = DRMODE_SOLID;
|
||||
static int xmargin = 0;
|
||||
|
|
@ -686,35 +686,35 @@ static void nopixel(int x, int y)
|
|||
(void)y;
|
||||
}
|
||||
|
||||
lcd_pixelfunc_type* const lcd_remote_pixelfuncs[8] = {
|
||||
lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8] = {
|
||||
flippixel, nopixel, setpixel, setpixel,
|
||||
nopixel, clearpixel, nopixel, clearpixel
|
||||
};
|
||||
|
||||
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address ^= bits & mask;
|
||||
}
|
||||
|
||||
static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bgblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bgblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address &= bits | ~mask;
|
||||
}
|
||||
|
||||
static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address |= bits & mask;
|
||||
}
|
||||
|
||||
static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
|
|
@ -722,30 +722,30 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
|||
*address = data ^ (bits & mask);
|
||||
}
|
||||
|
||||
static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address ^= ~bits & mask;
|
||||
}
|
||||
|
||||
static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bginvblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bginvblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address &= ~(bits & mask);
|
||||
}
|
||||
|
||||
static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address |= ~bits & mask;
|
||||
}
|
||||
|
||||
static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
|
|
@ -753,7 +753,7 @@ static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
|||
*address = data ^ (bits & mask);
|
||||
}
|
||||
|
||||
lcd_blockfunc_type* const lcd_remote_blockfuncs[8] = {
|
||||
lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8] = {
|
||||
flipblock, bgblock, fgblock, solidblock,
|
||||
flipinvblock, bginvblock, fginvblock, solidinvblock
|
||||
};
|
||||
|
|
@ -785,7 +785,7 @@ void lcd_remote_drawline(int x1, int y1, int x2, int y2)
|
|||
int d, dinc1, dinc2;
|
||||
int x, xinc1, xinc2;
|
||||
int y, yinc1, yinc2;
|
||||
lcd_pixelfunc_type *pfunc = lcd_remote_pixelfuncs[drawmode];
|
||||
lcd_remote_pixelfunc_type *pfunc = lcd_remote_pixelfuncs[drawmode];
|
||||
|
||||
deltax = abs(x2 - x1);
|
||||
deltay = abs(y2 - y1);
|
||||
|
|
@ -851,9 +851,9 @@ void lcd_remote_drawline(int x1, int y1, int x2, int y2)
|
|||
void lcd_remote_hline(int x1, int x2, int y)
|
||||
{
|
||||
int x;
|
||||
unsigned char *dst, *dst_end;
|
||||
fb_remote_data *dst, *dst_end;
|
||||
unsigned mask;
|
||||
lcd_blockfunc_type *bfunc;
|
||||
lcd_remote_blockfunc_type *bfunc;
|
||||
|
||||
/* direction flip */
|
||||
if (x2 < x1)
|
||||
|
|
@ -888,9 +888,9 @@ void lcd_remote_hline(int x1, int x2, int y)
|
|||
void lcd_remote_vline(int x, int y1, int y2)
|
||||
{
|
||||
int ny;
|
||||
unsigned char *dst;
|
||||
fb_remote_data *dst;
|
||||
unsigned mask, mask_bottom;
|
||||
lcd_blockfunc_type *bfunc;
|
||||
lcd_remote_blockfunc_type *bfunc;
|
||||
|
||||
/* direction flip */
|
||||
if (y2 < y1)
|
||||
|
|
@ -946,10 +946,10 @@ void lcd_remote_drawrect(int x, int y, int width, int height)
|
|||
void lcd_remote_fillrect(int x, int y, int width, int height)
|
||||
{
|
||||
int ny;
|
||||
unsigned char *dst, *dst_end;
|
||||
fb_remote_data *dst, *dst_end;
|
||||
unsigned mask, mask_bottom;
|
||||
unsigned bits = 0;
|
||||
lcd_blockfunc_type *bfunc;
|
||||
lcd_remote_blockfunc_type *bfunc;
|
||||
bool fillopt = false;
|
||||
|
||||
/* nothing to draw? */
|
||||
|
|
@ -1000,7 +1000,7 @@ void lcd_remote_fillrect(int x, int y, int width, int height)
|
|||
memset(dst, bits, width);
|
||||
else
|
||||
{
|
||||
unsigned char *dst_row = dst;
|
||||
fb_remote_data *dst_row = dst;
|
||||
|
||||
dst_end = dst_row + width;
|
||||
do
|
||||
|
|
@ -1043,9 +1043,9 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
int stride, int x, int y, int width, int height)
|
||||
{
|
||||
int shift, ny;
|
||||
unsigned char *dst, *dst_end;
|
||||
fb_remote_data *dst, *dst_end;
|
||||
unsigned mask, mask_bottom;
|
||||
lcd_blockfunc_type *bfunc;
|
||||
lcd_remote_blockfunc_type *bfunc;
|
||||
|
||||
/* nothing to draw? */
|
||||
if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH)
|
||||
|
|
@ -1070,9 +1070,9 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
if (y + height > LCD_REMOTE_HEIGHT)
|
||||
height = LCD_REMOTE_HEIGHT - y;
|
||||
|
||||
src += stride * (src_y >> 3) + src_x; /* move starting point */
|
||||
src_y &= 7;
|
||||
y -= src_y;
|
||||
src += stride * (src_y >> 3) + src_x; /* move starting point */
|
||||
src_y &= 7;
|
||||
y -= src_y;
|
||||
dst = &lcd_remote_framebuffer[y>>3][x];
|
||||
shift = y & 7;
|
||||
ny = height - 1 + shift + src_y;
|
||||
|
|
@ -1092,7 +1092,7 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
else
|
||||
{
|
||||
const unsigned char *src_row = src;
|
||||
unsigned char *dst_row = dst;
|
||||
fb_remote_data *dst_row = dst;
|
||||
|
||||
dst_end = dst_row + width;
|
||||
do
|
||||
|
|
@ -1122,7 +1122,7 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
do
|
||||
{
|
||||
const unsigned char *src_col = src++;
|
||||
unsigned char *dst_col = dst++;
|
||||
fb_remote_data *dst_col = dst++;
|
||||
unsigned mask_col = mask;
|
||||
unsigned data = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
/*** globals ***/
|
||||
|
||||
unsigned char lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH] IBSS_ATTR;
|
||||
fb_data lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH] IBSS_ATTR;
|
||||
|
||||
static const unsigned char dibits[16] ICONST_ATTR = {
|
||||
0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F,
|
||||
|
|
@ -357,21 +357,28 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
|
|||
|
||||
static void setpixel(int x, int y)
|
||||
{
|
||||
unsigned char *data = &lcd_framebuffer[y>>2][x];
|
||||
unsigned mask = pixmask[y & 3];
|
||||
*data = (*data & ~mask) | (fg_pattern & mask);
|
||||
fb_data *address = &lcd_framebuffer[y>>2][x];
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ fg_pattern) & mask);
|
||||
}
|
||||
|
||||
static void clearpixel(int x, int y)
|
||||
{
|
||||
unsigned char *data = &lcd_framebuffer[y>>2][x];
|
||||
unsigned mask = pixmask[y & 3];
|
||||
*data = (*data & ~mask) | (bg_pattern & mask);
|
||||
fb_data *address = &lcd_framebuffer[y>>2][x];
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ bg_pattern) & mask);
|
||||
}
|
||||
|
||||
static void flippixel(int x, int y)
|
||||
{
|
||||
lcd_framebuffer[y>>2][x] ^= pixmask[y & 3];
|
||||
unsigned mask = pixmask[y & 3];
|
||||
fb_data *address = &lcd_framebuffer[y>>2][x];
|
||||
|
||||
*address ^= mask;
|
||||
}
|
||||
|
||||
static void nopixel(int x, int y)
|
||||
|
|
@ -386,34 +393,34 @@ lcd_pixelfunc_type* const lcd_pixelfuncs[8] = {
|
|||
};
|
||||
|
||||
/* 'mask' and 'bits' contain 2 bits per pixel */
|
||||
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address ^= bits & mask;
|
||||
}
|
||||
|
||||
static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bgblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bgblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ bg_pattern) & mask & ~bits);
|
||||
}
|
||||
|
||||
static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fgblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fgblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ fg_pattern) & mask & bits);
|
||||
}
|
||||
|
||||
static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
unsigned bgp = bg_pattern;
|
||||
|
|
@ -422,34 +429,34 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
|
|||
*address = data ^ ((data ^ bits) & mask);
|
||||
}
|
||||
|
||||
static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
*address ^= ~bits & mask;
|
||||
}
|
||||
|
||||
static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ bg_pattern) & mask & bits);
|
||||
}
|
||||
|
||||
static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
*address = data ^ ((data ^ fg_pattern) & mask & ~bits);
|
||||
}
|
||||
|
||||
static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
ICODE_ATTR;
|
||||
static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
unsigned fgp = fg_pattern;
|
||||
|
|
@ -463,7 +470,7 @@ lcd_blockfunc_type* const lcd_blockfuncs[8] = {
|
|||
flipinvblock, bginvblock, fginvblock, solidinvblock
|
||||
};
|
||||
|
||||
static inline void setblock(unsigned char *address, unsigned mask, unsigned bits)
|
||||
static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
|
||||
{
|
||||
unsigned data = *address;
|
||||
|
||||
|
|
@ -564,7 +571,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
|
|||
void lcd_hline(int x1, int x2, int y)
|
||||
{
|
||||
int x;
|
||||
unsigned char *dst, *dst_end;
|
||||
fb_data *dst, *dst_end;
|
||||
unsigned mask;
|
||||
lcd_blockfunc_type *bfunc;
|
||||
|
||||
|
|
@ -600,7 +607,7 @@ void lcd_hline(int x1, int x2, int y)
|
|||
void lcd_vline(int x, int y1, int y2)
|
||||
{
|
||||
int ny;
|
||||
unsigned char *dst;
|
||||
fb_data *dst;
|
||||
unsigned mask, mask_bottom;
|
||||
lcd_blockfunc_type *bfunc;
|
||||
|
||||
|
|
@ -657,7 +664,7 @@ void lcd_drawrect(int x, int y, int width, int height)
|
|||
void lcd_fillrect(int x, int y, int width, int height)
|
||||
{
|
||||
int ny;
|
||||
unsigned char *dst, *dst_end;
|
||||
fb_data *dst, *dst_end;
|
||||
unsigned mask, mask_bottom;
|
||||
unsigned bits = 0;
|
||||
lcd_blockfunc_type *bfunc;
|
||||
|
|
@ -712,7 +719,7 @@ void lcd_fillrect(int x, int y, int width, int height)
|
|||
memset(dst, bits, width);
|
||||
else
|
||||
{
|
||||
unsigned char *dst_row = dst;
|
||||
fb_data *dst_row = dst;
|
||||
|
||||
dst_end = dst_row + width;
|
||||
do
|
||||
|
|
@ -755,7 +762,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
int stride, int x, int y, int width, int height)
|
||||
{
|
||||
int shift, ny;
|
||||
unsigned char *dst, *dst_end;
|
||||
fb_data *dst, *dst_end;
|
||||
unsigned mask, mask_bottom;
|
||||
lcd_blockfunc_type *bfunc;
|
||||
|
||||
|
|
@ -800,7 +807,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
for (; ny >= 8; ny -= 8)
|
||||
{
|
||||
const unsigned char *src_row = src;
|
||||
unsigned char *dst_row = dst + LCD_WIDTH;
|
||||
fb_data *dst_row = dst + LCD_WIDTH;
|
||||
|
||||
dmask1 = dibits[mask&0x0F];
|
||||
dmask2 = dibits[(mask>>4)&0x0F];
|
||||
|
|
@ -863,7 +870,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
do
|
||||
{
|
||||
const unsigned char *src_col = src++;
|
||||
unsigned char *dst_col = dst++;
|
||||
fb_data *dst_col = dst++;
|
||||
unsigned mask_col = mask;
|
||||
unsigned data = 0;
|
||||
|
||||
|
|
@ -916,14 +923,14 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig
|
|||
* This is the same as the internal lcd hw format. */
|
||||
|
||||
/* Draw a partial native bitmap */
|
||||
void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
||||
void lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
|
||||
int stride, int x, int y, int width, int height)
|
||||
ICODE_ATTR;
|
||||
void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
||||
void lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
|
||||
int stride, int x, int y, int width, int height)
|
||||
{
|
||||
int shift, ny;
|
||||
unsigned char *dst, *dst_end;
|
||||
fb_data *dst, *dst_end;
|
||||
unsigned mask, mask_bottom;
|
||||
|
||||
/* nothing to draw? */
|
||||
|
|
@ -949,9 +956,9 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
if (y + height > LCD_HEIGHT)
|
||||
height = LCD_HEIGHT - y;
|
||||
|
||||
src += stride * (src_y >> 2) + src_x; /* move starting point */
|
||||
src_y &= 3;
|
||||
y -= src_y;
|
||||
src += stride * (src_y >> 2) + src_x; /* move starting point */
|
||||
src_y &= 3;
|
||||
y -= src_y;
|
||||
dst = &lcd_framebuffer[y>>2][x];
|
||||
shift = y & 3;
|
||||
ny = height - 1 + shift + src_y;
|
||||
|
|
@ -967,15 +974,14 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
memcpy(dst, src, width);
|
||||
else
|
||||
{
|
||||
const unsigned char *src_row = src;
|
||||
unsigned char *dst_row = dst;
|
||||
const fb_data *src_row = src;
|
||||
fb_data *dst_row = dst;
|
||||
|
||||
dst_end = dst_row + width;
|
||||
do
|
||||
setblock(dst_row++, mask, *src_row++);
|
||||
while (dst_row < dst_end);
|
||||
}
|
||||
|
||||
src += stride;
|
||||
dst += LCD_WIDTH;
|
||||
mask = 0xFFu;
|
||||
|
|
@ -998,8 +1004,8 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
dst_end = dst + width;
|
||||
do
|
||||
{
|
||||
const unsigned char *src_col = src++;
|
||||
unsigned char *dst_col = dst++;
|
||||
const fb_data *src_col = src++;
|
||||
fb_data *dst_col = dst++;
|
||||
unsigned mask_col = mask;
|
||||
unsigned data = 0;
|
||||
|
||||
|
|
@ -1027,7 +1033,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|||
}
|
||||
|
||||
/* Draw a full native bitmap */
|
||||
void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height)
|
||||
void lcd_bitmap(const fb_data *src, int x, int y, int width, int height)
|
||||
{
|
||||
lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
|
||||
}
|
||||
|
|
@ -1290,4 +1296,3 @@ static void scroll_thread(void)
|
|||
sleep(scroll_ticks);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#define LCD_REMOTE_HEIGHT 64
|
||||
#define LCD_REMOTE_DEPTH 1
|
||||
|
||||
#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
|
||||
|
||||
#define CONFIG_KEYPAD IRIVER_H100_PAD
|
||||
|
||||
#define CONFIG_REMOTE_KEYPAD H100_REMOTE
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
#define LCD_REMOTE_HEIGHT 64
|
||||
#define LCD_REMOTE_DEPTH 1
|
||||
|
||||
#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
|
||||
|
||||
#define CONFIG_KEYPAD IRIVER_H100_PAD
|
||||
|
||||
#define CONFIG_REMOTE_KEYPAD H100_REMOTE
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
#define LCD_REMOTE_HEIGHT 64
|
||||
#define LCD_REMOTE_DEPTH 1
|
||||
|
||||
#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
|
||||
|
||||
#define CONFIG_KEYPAD IRIVER_H300_PAD
|
||||
|
||||
#define CONFIG_REMOTE_KEYPAD H300_REMOTE
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
|
||||
#define STYLE_DEFAULT 0
|
||||
#define STYLE_INVERT 1
|
||||
|
||||
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
|
||||
#define REMOTETYPE_H100_LCD 1
|
||||
#define REMOTETYPE_H300_LCD 2
|
||||
|
|
@ -37,35 +34,82 @@
|
|||
extern int remote_type(void);
|
||||
#endif
|
||||
|
||||
#define STYLE_DEFAULT 0
|
||||
#define STYLE_INVERT 1
|
||||
|
||||
#if LCD_REMOTE_DEPTH <= 8
|
||||
#if (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) \
|
||||
|| (LCD_REMOTE_PIXELFORMAT == HORIZONTAL_INTERLEAVED)
|
||||
typedef unsigned short fb_remote_data;
|
||||
#else
|
||||
typedef unsigned char fb_remote_data;
|
||||
#endif
|
||||
#elif LCD_DEPTH <= 16
|
||||
typedef unsigned short fb_remote_data;
|
||||
#else
|
||||
typedef unsigned long fb_remote_data;
|
||||
#endif
|
||||
|
||||
#ifndef LCD_REMOTE_FBWIDTH
|
||||
#define LCD_REMOTE_FBWIDTH LCD_REMOTE_WIDTH
|
||||
#endif
|
||||
|
||||
/* Low-level drawing function types */
|
||||
typedef void lcd_remote_pixelfunc_type(int x, int y);
|
||||
typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask,
|
||||
unsigned bits);
|
||||
|
||||
#if LCD_REMOTE_DEPTH > 1 /* greyscale */
|
||||
#define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1)
|
||||
#define LCD_REMOTE_BRIGHTNESS(y) (((y) * LCD_REMOTE_MAX_LEVEL + 127) / 255)
|
||||
|
||||
#define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0)
|
||||
#define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85)
|
||||
#define LCD_REMOTE_LIGHTGRAY LCD_REMOTE_BRIGHTNESS(170)
|
||||
#define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255)
|
||||
#define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK
|
||||
#define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE
|
||||
|
||||
#endif
|
||||
|
||||
/* Memory copy of display bitmap */
|
||||
#if LCD_REMOTE_DEPTH == 1
|
||||
extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
|
||||
#elif LCD_REMOTE_DEPTH == 2
|
||||
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
|
||||
extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern void lcd_remote_init(void);
|
||||
extern int lcd_remote_default_contrast(void);
|
||||
extern void lcd_remote_set_contrast(int val);
|
||||
extern void lcd_remote_emireduce(bool state);
|
||||
|
||||
extern void lcd_remote_clear_display(void);
|
||||
extern void lcd_remote_puts(int x, int y, const unsigned char *string);
|
||||
extern void lcd_remote_puts_style(int x, int y, const unsigned char *string,
|
||||
extern void lcd_remote_puts(int x, int y, const unsigned char *str);
|
||||
extern void lcd_remote_puts_style(int x, int y, const unsigned char *str,
|
||||
int style);
|
||||
extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str, int offset);
|
||||
extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset);
|
||||
extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str,
|
||||
int offset);
|
||||
extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str,
|
||||
int style, int offset);
|
||||
extern void lcd_remote_putc(int x, int y, unsigned short ch);
|
||||
extern void lcd_remote_stop_scroll(void);
|
||||
extern void lcd_remote_scroll_speed(int speed);
|
||||
extern void lcd_remote_scroll_delay(int ms);
|
||||
extern void lcd_remote_puts_scroll(int x, int y, const unsigned char* string);
|
||||
extern void lcd_remote_puts_scroll_style(int x, int y,const unsigned char* string,
|
||||
int style);
|
||||
extern void lcd_remote_puts_scroll_offset(int x, int y, const unsigned char *string,
|
||||
int offset);
|
||||
extern void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *string,
|
||||
extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str);
|
||||
extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str,
|
||||
int style);
|
||||
extern void lcd_remote_puts_scroll_offset(int x, int y,
|
||||
const unsigned char *str, int offset);
|
||||
extern void lcd_remote_puts_scroll_style_offset(int x, int y,
|
||||
const unsigned char *string,
|
||||
int style, int offset);
|
||||
|
||||
extern void lcd_remote_update(void);
|
||||
extern void lcd_remote_update_rect(int x, int y, int width, int height);
|
||||
|
||||
/* Memory copy of display bitmap */
|
||||
extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
|
||||
|
||||
extern void lcd_remote_set_invert_display(bool yesno);
|
||||
extern void lcd_remote_set_flip(bool yesno);
|
||||
extern void lcd_remote_roll(int pixels);
|
||||
|
|
@ -78,25 +122,50 @@ extern int lcd_remote_getymargin(void);
|
|||
extern void lcd_remote_setfont(int font);
|
||||
extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
|
||||
|
||||
/* low level drawing function pointer arrays */
|
||||
extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8];
|
||||
extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8];
|
||||
|
||||
extern void lcd_remote_drawpixel(int x, int y);
|
||||
extern void lcd_remote_drawline(int x1, int y1, int x2, int y2);
|
||||
extern void lcd_remote_hline(int x1, int x2, int y);
|
||||
extern void lcd_remote_vline(int x, int y1, int y2);
|
||||
extern void lcd_remote_drawrect(int x, int y, int width, int height);
|
||||
extern void lcd_remote_fillrect(int x, int y, int width, int height);
|
||||
extern void lcd_remote_bitmap_part(const unsigned char *src, int src_x,
|
||||
extern void lcd_remote_bitmap_part(const fb_remote_data *src, int src_x,
|
||||
int src_y, int stride, int x, int y,
|
||||
int width, int height);
|
||||
extern void lcd_remote_bitmap(const unsigned char *src, int x, int y,
|
||||
extern void lcd_remote_bitmap(const fb_remote_data *src, int x, int y,
|
||||
int width, int height);
|
||||
extern void lcd_remote_putsxy(int x, int y, const unsigned char *string);
|
||||
extern void lcd_remote_putsxy(int x, int y, const unsigned char *str);
|
||||
|
||||
extern void lcd_remote_invertscroll(int x, int y);
|
||||
extern void lcd_remote_bidir_scroll(int threshold);
|
||||
extern void lcd_remote_scroll_step(int pixels);
|
||||
|
||||
#if LCD_REMOTE_DEPTH > 1
|
||||
extern void lcd_remote_set_foreground(unsigned foreground);
|
||||
extern unsigned lcd_remote_get_foreground(void);
|
||||
extern void lcd_remote_set_background(unsigned background);
|
||||
extern unsigned lcd_remote_get_background(void);
|
||||
extern void lcd_remote_set_drawinfo(int mode, unsigned foreground,
|
||||
unsigned background);
|
||||
|
||||
extern void lcd_remote_mono_bitmap_part(const unsigned char *src, int src_x,
|
||||
int src_y, int stride, int x, int y,
|
||||
int width, int height);
|
||||
extern void lcd_remote_mono_bitmap(const unsigned char *src, int x, int y,
|
||||
int width, int height);
|
||||
extern void lcd_remote_bitmap_transparent_part(const fb_remote_data *src,
|
||||
int src_x, int src_y,
|
||||
int stride, int x, int y,
|
||||
int width, int height);
|
||||
extern void lcd_bitmap_remote_transparent(const fb_remote_data *src, int x,
|
||||
int y, int width, int height);
|
||||
#else /* LCD_REMOTE_DEPTH == 1 */
|
||||
#define lcd_remote_mono_bitmap lcd_remote_bitmap
|
||||
#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part
|
||||
#endif /* LCD_REMOTE_DEPTH */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __LCD_REMOTE_H__ */
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ extern void lcd_jump_scroll_delay(int ms);
|
|||
|
||||
/* Low-level drawing function types */
|
||||
typedef void lcd_pixelfunc_type(int x, int y);
|
||||
typedef void lcd_blockfunc_type(unsigned char *address, unsigned mask, unsigned bits);
|
||||
typedef void lcd_blockfunc_type(fb_data *address, unsigned mask, unsigned bits);
|
||||
#if LCD_DEPTH >= 8
|
||||
typedef void lcd_fastpixelfunc_type(fb_data *address);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue