Merge various drawmodes; revert to C for common code

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12021 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Greg White 2007-01-16 13:56:38 +00:00
parent cd05dbc7f4
commit 9980b4ed6c

View file

@ -155,7 +155,8 @@ void lcd_set_background(unsigned color)
void lcd_device_prepare_backdrop(fb_data* backdrop) void lcd_device_prepare_backdrop(fb_data* backdrop)
{ {
invalidate_dcache_range((void *)backdrop, (LCD_HEIGHT * sizeof(fb_data) * LCD_WIDTH)); if(backdrop)
invalidate_dcache_range((void *)backdrop, (LCD_HEIGHT * sizeof(fb_data) * LCD_WIDTH));
} }
void lcd_clear_display_dma(void) void lcd_clear_display_dma(void)
@ -330,65 +331,53 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
dst = LCDADDR(x, y); dst = LCDADDR(x, y);
int drawmode = lcd_get_drawmode(); int drawmode = lcd_get_drawmode();
if(drawmode == DRMODE_SOLID) { fb_data *backdrop = lcd_get_backdrop();
do bool has_backdrop = backdrop ? true : false;
{ backdrop = backdrop + y * LCD_WIDTH + x;
const unsigned char *src_col = src++; lcd_fastpixelfunc_type *fgfunc = lcd_fastpixelfuncs[drawmode];;
unsigned data = *src_col >> src_y; lcd_fastpixelfunc_type *bgfunc = lcd_fastpixelfuncs[drawmode ^ DRMODE_INVERSEVID];;
fb_data *dst_col = dst++; do {
int numbits = 8 - src_y; const unsigned char *src_col = src++;
unsigned data = *src_col >> src_y;
dst_end = dst_col + height * LCD_WIDTH; fb_data *dst_col = dst++;
asm volatile( int numbits = 8 - src_y;
"transrowstart: \n" fb_data *backdrop_col = backdrop++;
"tst %0, #1 \n" /* Test data bit 1 */ dst_end = dst_col + height * LCD_WIDTH;
"strneh %6, [%1] \n" /* If it is set, set pixel */ do {
"add %1, %1, #480 \n" /* dst_col += LCD_WIDTH (x2) */ switch(drawmode) {
"sub %7, %7, #1 \n" /* numbits-- */ case DRMODE_SOLID:
"cmp %7, #0 \n" if (data & 0x01)
"movne %0, %0, LSR #1 \n" /* Shift data */ *dst_col = fg_pattern;
"bne transrowstart \n" /* if(numbits != 0) goto transrowstart */ else
"add %5, %5, %4 \n" /* src_col += stride */ *dst_col = has_backdrop ? *backdrop_col : bg_pattern;
"ldrb %0, [%5] \n" /* data = *srccol */ break;
"mov %7, #8 \n" /* numbits = 8; */ case DRMODE_FG:
"cmp %1, %3 \n" /* if(dst_col < dst_end */ if (data & 0x01)
"blt transrowstart \n" /* Keep going */ *dst_col = fg_pattern;
: : "r" (data), "r" (dst_col), "r" (numbits), "r" (dst_end), "r" (stride), "r" (src_col), "r" (fg_pattern), "r" (numbits) ); break;
} case DRMODE_INVERSEVID:
while (src < src_end); if(!(data & 0x01))
} *dst_col = has_backdrop ? *backdrop_col : bg_pattern;
else { else
lcd_fastpixelfunc_type *fgfunc = lcd_fastpixelfuncs[drawmode];; *dst_col = fg_pattern;
lcd_fastpixelfunc_type *bgfunc = lcd_fastpixelfuncs[drawmode ^ DRMODE_INVERSEVID];; break;
do default:
{ if (data & 0x01)
const unsigned char *src_col = src++; fgfunc(dst_col);
unsigned data = *src_col >> src_y; else
fb_data *dst_col = dst++; bgfunc(dst_col);
int numbits = 8 - src_y; break;
};
dst_end = dst_col + height * LCD_WIDTH; dst_col += LCD_WIDTH;
do backdrop_col += LCD_WIDTH;
{ data >>= 1;
if (data & 0x01) if (--numbits == 0) {
fgfunc(dst_col); src_col += stride;
else data = *src_col;
bgfunc(dst_col); numbits = 8;
dst_col += LCD_WIDTH;
data >>= 1;
if (--numbits == 0)
{
src_col += stride;
data = *src_col;
numbits = 8;
}
} }
while (dst_col < dst_end); } while (dst_col < dst_end);
} } while (src < src_end);
while (src < src_end);
}
} }