forked from len0rd/rockbox
Two tiny optimisations for mono bitmap drawing on greyscale displays: (1) H1x0, M5: Manipulate destination masks directly for the aligned case - ~0.7% speedup. (2) Greyscale ipods: Use sentinel method for reloading data like the 16 bit driver does - ~1.5% speedup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21139 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
294ece8bd6
commit
72061047d1
2 changed files with 17 additions and 16 deletions
|
|
@ -732,8 +732,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const unsigned char *src_col = src++;
|
const unsigned char *src_col = src++;
|
||||||
unsigned data = *src_col >> src_y;
|
unsigned data = (*src_col | 0x100) >> src_y; /* bit 8 == sentinel */
|
||||||
int numbits = 8 - ((int)src_y);
|
|
||||||
|
|
||||||
ymax = y + height;
|
ymax = y + height;
|
||||||
ny = y;
|
ny = y;
|
||||||
|
|
@ -747,11 +746,10 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
|
||||||
ny++;
|
ny++;
|
||||||
|
|
||||||
data >>= 1;
|
data >>= 1;
|
||||||
if (--numbits == 0)
|
if (data == 0x001)
|
||||||
{
|
{
|
||||||
src_col += stride;
|
src_col += stride;
|
||||||
data = *src_col;
|
data = *src_col | 0x100;
|
||||||
numbits = 8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (ny < ymax);
|
while (ny < ymax);
|
||||||
|
|
|
||||||
|
|
@ -719,7 +719,6 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
|
||||||
{
|
{
|
||||||
int shift, ny;
|
int shift, ny;
|
||||||
fb_data *dst, *dst_end;
|
fb_data *dst, *dst_end;
|
||||||
unsigned mask, mask_bottom;
|
|
||||||
lcd_blockfunc_type *bfunc;
|
lcd_blockfunc_type *bfunc;
|
||||||
|
|
||||||
/* nothing to draw? */
|
/* nothing to draw? */
|
||||||
|
|
@ -757,20 +756,21 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
|
||||||
ny = height - 1 + shift + src_y;
|
ny = height - 1 + shift + src_y;
|
||||||
|
|
||||||
bfunc = lcd_blockfuncs[current_vp->drawmode];
|
bfunc = lcd_blockfuncs[current_vp->drawmode];
|
||||||
mask = 0xFFu << (shift + src_y);
|
|
||||||
mask_bottom = 0xFFu >> (~ny & 7);
|
|
||||||
|
|
||||||
if (shift == 0)
|
if (shift == 0)
|
||||||
{
|
{
|
||||||
unsigned dmask1, dmask2, data;
|
unsigned dmask1, dmask2, dmask_bottom, data;
|
||||||
|
|
||||||
|
dmask1 = 0xFFFFu << (2 * (shift + src_y));
|
||||||
|
dmask2 = dmask1 >> 8;
|
||||||
|
dmask1 &= 0xFFu;
|
||||||
|
dmask_bottom = 0xFFFFu >> (2 * (~ny & 7));
|
||||||
|
|
||||||
for (; ny >= 8; ny -= 8)
|
for (; ny >= 8; ny -= 8)
|
||||||
{
|
{
|
||||||
const unsigned char *src_row = src;
|
const unsigned char *src_row = src;
|
||||||
fb_data *dst_row = dst + LCD_WIDTH;
|
fb_data *dst_row = dst + LCD_WIDTH;
|
||||||
|
|
||||||
dmask1 = lcd_dibits[mask&0x0F];
|
|
||||||
dmask2 = lcd_dibits[(mask>>4)&0x0F];
|
|
||||||
dst_end = dst_row + width;
|
dst_end = dst_row + width;
|
||||||
|
|
||||||
if (dmask1 != 0)
|
if (dmask1 != 0)
|
||||||
|
|
@ -791,11 +791,11 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
|
||||||
}
|
}
|
||||||
src += stride;
|
src += stride;
|
||||||
dst += 2*LCD_WIDTH;
|
dst += 2*LCD_WIDTH;
|
||||||
mask = 0xFFu;
|
dmask1 = dmask2 = 0xFFu;
|
||||||
}
|
}
|
||||||
mask &= mask_bottom;
|
dmask1 &= dmask_bottom;
|
||||||
dmask1 = lcd_dibits[mask&0x0F];
|
/* & 0xFFu is unnecessary here - dmask1 can't exceed that*/
|
||||||
dmask2 = lcd_dibits[(mask>>4)&0x0F];
|
dmask2 &= (dmask_bottom >> 8);
|
||||||
dst_end = dst + width;
|
dst_end = dst + width;
|
||||||
|
|
||||||
if (dmask1 != 0)
|
if (dmask1 != 0)
|
||||||
|
|
@ -826,6 +826,9 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unsigned mask = 0xFFu << (shift + src_y);
|
||||||
|
unsigned mask_bottom = 0xFFu >> (~ny & 7);
|
||||||
|
|
||||||
dst_end = dst + width;
|
dst_end = dst + width;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue