forked from len0rd/rockbox
Move mono DRMODE optimizations from Gigabeat to all 16-bit targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12062 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
10dfc06163
commit
186623e709
2 changed files with 75 additions and 150 deletions
|
|
@ -546,79 +546,92 @@ void lcd_fillrect(int x, int y, int width, int height)
|
||||||
|
|
||||||
/* Draw a partial monochrome bitmap */
|
/* Draw a partial monochrome bitmap */
|
||||||
|
|
||||||
#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
|
|
||||||
void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
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 stride, int x, int y, int width, int height)
|
||||||
ICODE_ATTR;
|
ICODE_ATTR;
|
||||||
void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
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 stride, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
const unsigned char *src_end;
|
const unsigned char *src_end;
|
||||||
fb_data *dst, *dst_end;
|
fb_data *dst, *dst_end;
|
||||||
lcd_fastpixelfunc_type *fgfunc;
|
|
||||||
lcd_fastpixelfunc_type *bgfunc;
|
|
||||||
|
|
||||||
/* nothing to draw? */
|
/* nothing to draw? */
|
||||||
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|
||||||
|| (x + width <= 0) || (y + height <= 0))
|
|| (x + width <= 0) || (y + height <= 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* clipping */
|
/* clipping */
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
{
|
{
|
||||||
width += x;
|
width += x;
|
||||||
src_x -= x;
|
src_x -= x;
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
{
|
{
|
||||||
height += y;
|
height += y;
|
||||||
src_y -= y;
|
src_y -= y;
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
if (x + width > LCD_WIDTH)
|
if (x + width > LCD_WIDTH)
|
||||||
width = LCD_WIDTH - x;
|
width = LCD_WIDTH - x;
|
||||||
if (y + height > LCD_HEIGHT)
|
if (y + height > LCD_HEIGHT)
|
||||||
height = LCD_HEIGHT - y;
|
height = LCD_HEIGHT - y;
|
||||||
|
|
||||||
src += stride * (src_y >> 3) + src_x; /* move starting point */
|
src += stride * (src_y >> 3) + src_x; /* move starting point */
|
||||||
src_y &= 7;
|
src_y &= 7;
|
||||||
src_end = src + width;
|
src_end = src + width;
|
||||||
|
|
||||||
dst = LCDADDR(x, y);
|
dst = LCDADDR(x, y);
|
||||||
fgfunc = lcd_fastpixelfuncs[drawmode];
|
int drawmode = lcd_get_drawmode();
|
||||||
bgfunc = lcd_fastpixelfuncs[drawmode ^ DRMODE_INVERSEVID];
|
fb_data *backdrop = lcd_get_backdrop();
|
||||||
|
bool has_backdrop = backdrop ? true : false;
|
||||||
do
|
backdrop = backdrop + y * LCD_WIDTH + x;
|
||||||
{
|
lcd_fastpixelfunc_type *fgfunc = lcd_fastpixelfuncs[drawmode];;
|
||||||
const unsigned char *src_col = src++;
|
lcd_fastpixelfunc_type *bgfunc = lcd_fastpixelfuncs[drawmode ^ DRMODE_INVERSEVID];;
|
||||||
unsigned data = *src_col >> src_y;
|
do {
|
||||||
fb_data *dst_col = dst++;
|
const unsigned char *src_col = src++;
|
||||||
int numbits = 8 - src_y;
|
unsigned data = *src_col >> src_y;
|
||||||
|
fb_data *dst_col = dst++;
|
||||||
dst_end = dst_col + height * LCD_WIDTH;
|
int numbits = 8 - src_y;
|
||||||
do
|
fb_data *backdrop_col = backdrop++;
|
||||||
{
|
dst_end = dst_col + height * LCD_WIDTH;
|
||||||
if (data & 0x01)
|
do {
|
||||||
fgfunc(dst_col);
|
switch(drawmode) {
|
||||||
else
|
case DRMODE_SOLID:
|
||||||
bgfunc(dst_col);
|
if (data & 0x01)
|
||||||
|
*dst_col = fg_pattern;
|
||||||
dst_col += LCD_WIDTH;
|
else
|
||||||
|
*dst_col = has_backdrop ? *backdrop_col : bg_pattern;
|
||||||
data >>= 1;
|
break;
|
||||||
if (--numbits == 0)
|
case DRMODE_FG:
|
||||||
{
|
if (data & 0x01)
|
||||||
src_col += stride;
|
*dst_col = fg_pattern;
|
||||||
data = *src_col;
|
break;
|
||||||
numbits = 8;
|
case (DRMODE_SOLID|DRMODE_INVERSEVID):
|
||||||
}
|
if(data & 0x01)
|
||||||
}
|
*dst_col = has_backdrop ? *backdrop_col : bg_pattern;
|
||||||
while (dst_col < dst_end);
|
else
|
||||||
}
|
*dst_col = fg_pattern;
|
||||||
while (src < src_end);
|
break;
|
||||||
|
default:
|
||||||
|
if (data & 0x01)
|
||||||
|
fgfunc(dst_col);
|
||||||
|
else
|
||||||
|
bgfunc(dst_col);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
dst_col += LCD_WIDTH;
|
||||||
|
backdrop_col += LCD_WIDTH;
|
||||||
|
data >>= 1;
|
||||||
|
if (--numbits == 0) {
|
||||||
|
src_col += stride;
|
||||||
|
data = *src_col;
|
||||||
|
numbits = 8;
|
||||||
|
}
|
||||||
|
} while (dst_col < dst_end);
|
||||||
|
} while (src < src_end);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* Draw a full monochrome bitmap */
|
/* Draw a full monochrome bitmap */
|
||||||
void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height)
|
void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -293,94 +293,6 @@ void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
|
||||||
: : "r" (src), "r" (dst), "r" (width), "r" (dst_end), "r" (stride), "r" (transcolor) : "r0", "r1" );
|
: : "r" (src), "r" (dst), "r" (width), "r" (dst_end), "r" (stride), "r" (transcolor) : "r0", "r1" );
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
ICODE_ATTR;
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
const unsigned char *src_end;
|
|
||||||
fb_data *dst, *dst_end;
|
|
||||||
|
|
||||||
/* nothing to draw? */
|
|
||||||
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|
|
||||||
|| (x + width <= 0) || (y + height <= 0))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* clipping */
|
|
||||||
if (x < 0)
|
|
||||||
{
|
|
||||||
width += x;
|
|
||||||
src_x -= x;
|
|
||||||
x = 0;
|
|
||||||
}
|
|
||||||
if (y < 0)
|
|
||||||
{
|
|
||||||
height += y;
|
|
||||||
src_y -= y;
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
if (x + width > LCD_WIDTH)
|
|
||||||
width = LCD_WIDTH - x;
|
|
||||||
if (y + height > LCD_HEIGHT)
|
|
||||||
height = LCD_HEIGHT - y;
|
|
||||||
|
|
||||||
src += stride * (src_y >> 3) + src_x; /* move starting point */
|
|
||||||
src_y &= 7;
|
|
||||||
src_end = src + width;
|
|
||||||
|
|
||||||
dst = LCDADDR(x, y);
|
|
||||||
int drawmode = lcd_get_drawmode();
|
|
||||||
fb_data *backdrop = lcd_get_backdrop();
|
|
||||||
bool has_backdrop = backdrop ? true : false;
|
|
||||||
backdrop = backdrop + y * LCD_WIDTH + x;
|
|
||||||
lcd_fastpixelfunc_type *fgfunc = lcd_fastpixelfuncs[drawmode];;
|
|
||||||
lcd_fastpixelfunc_type *bgfunc = lcd_fastpixelfuncs[drawmode ^ DRMODE_INVERSEVID];;
|
|
||||||
do {
|
|
||||||
const unsigned char *src_col = src++;
|
|
||||||
unsigned data = *src_col >> src_y;
|
|
||||||
fb_data *dst_col = dst++;
|
|
||||||
int numbits = 8 - src_y;
|
|
||||||
fb_data *backdrop_col = backdrop++;
|
|
||||||
dst_end = dst_col + height * LCD_WIDTH;
|
|
||||||
do {
|
|
||||||
switch(drawmode) {
|
|
||||||
case DRMODE_SOLID:
|
|
||||||
if (data & 0x01)
|
|
||||||
*dst_col = fg_pattern;
|
|
||||||
else
|
|
||||||
*dst_col = has_backdrop ? *backdrop_col : bg_pattern;
|
|
||||||
break;
|
|
||||||
case DRMODE_FG:
|
|
||||||
if (data & 0x01)
|
|
||||||
*dst_col = fg_pattern;
|
|
||||||
break;
|
|
||||||
case (DRMODE_SOLID|DRMODE_INVERSEVID):
|
|
||||||
if(data & 0x01)
|
|
||||||
*dst_col = has_backdrop ? *backdrop_col : bg_pattern;
|
|
||||||
else
|
|
||||||
*dst_col = fg_pattern;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (data & 0x01)
|
|
||||||
fgfunc(dst_col);
|
|
||||||
else
|
|
||||||
bgfunc(dst_col);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
dst_col += LCD_WIDTH;
|
|
||||||
backdrop_col += LCD_WIDTH;
|
|
||||||
data >>= 1;
|
|
||||||
if (--numbits == 0) {
|
|
||||||
src_col += stride;
|
|
||||||
data = *src_col;
|
|
||||||
numbits = 8;
|
|
||||||
}
|
|
||||||
} while (dst_col < dst_end);
|
|
||||||
} while (src < src_end);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define CSUB_X 2
|
#define CSUB_X 2
|
||||||
#define CSUB_Y 2
|
#define CSUB_Y 2
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue