summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-05-31 07:27:43 +0000
committerJens Arnold <amiconn@rockbox.org>2009-05-31 07:27:43 +0000
commitf31e86338aecfdb6fbba4170ea1ba82d0738c7c1 (patch)
treed60468aa6294af17faa83d921c8f26b7cd5d0cee
parentd76c820587d9990c1d3c97fdd68f7345f2072851 (diff)
downloadrockbox-f31e86338aecfdb6fbba4170ea1ba82d0738c7c1.tar.gz
rockbox-f31e86338aecfdb6fbba4170ea1ba82d0738c7c1.tar.bz2
rockbox-f31e86338aecfdb6fbba4170ea1ba82d0738c7c1.zip
Use bit-doubled mask everywhere in mono bitmap drawing. ~2% speedup, and smaller.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21141 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/lcd-2bit-vert.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c
index cff5eaffb1..801927eb37 100644
--- a/firmware/drivers/lcd-2bit-vert.c
+++ b/firmware/drivers/lcd-2bit-vert.c
@@ -719,6 +719,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
{
int shift, ny;
fb_data *dst, *dst_end;
+ unsigned mask, mask_bottom;
lcd_blockfunc_type *bfunc;
/* nothing to draw? */
@@ -754,17 +755,18 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
dst = &lcd_framebuffer[y>>2][x];
shift = y & 3;
ny = height - 1 + shift + src_y;
+ mask = 0xFFFFu << (2 * (shift + src_y));
+ /* Overflowing bits aren't important. */
+ mask_bottom = 0xFFFFu >> (2 * (~ny & 7));
bfunc = lcd_blockfuncs[current_vp->drawmode];
if (shift == 0)
{
- unsigned dmask1, dmask2, dmask_bottom, data;
+ unsigned dmask1, dmask2, data;
- dmask1 = 0xFFFFu << (2 * (shift + src_y));
- dmask2 = dmask1 >> 8;
- dmask1 &= 0xFFu;
- dmask_bottom = 0xFFFFu >> (2 * (~ny & 7));
+ dmask1 = mask & 0xFFu;
+ dmask2 = mask >> 8;
for (; ny >= 8; ny -= 8)
{
@@ -793,9 +795,9 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
dst += 2*LCD_WIDTH;
dmask1 = dmask2 = 0xFFu;
}
- dmask1 &= dmask_bottom;
+ dmask1 &= mask_bottom;
/* & 0xFFu is unnecessary here - dmask1 can't exceed that*/
- dmask2 &= (dmask_bottom >> 8);
+ dmask2 &= (mask_bottom >> 8);
dst_end = dst + width;
if (dmask1 != 0)
@@ -826,9 +828,6 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
}
else
{
- unsigned mask = 0xFFu << (shift + src_y);
- unsigned mask_bottom = 0xFFu >> (~ny & 7);
-
dst_end = dst + width;
do
{
@@ -841,27 +840,27 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
{
data |= *src_col << shift;
- if (mask_col & 0xFFu)
+ if (mask_col & 0xFFFFu)
{
- if (mask_col & 0x0F)
- bfunc(dst_col, lcd_dibits[mask_col&0x0F], lcd_dibits[data&0x0F]);
- bfunc(dst_col + LCD_WIDTH, lcd_dibits[(mask_col>>4)&0x0F],
+ if (mask_col & 0xFFu)
+ bfunc(dst_col, mask_col, lcd_dibits[data&0x0F]);
+ bfunc(dst_col + LCD_WIDTH, mask_col >> 8,
lcd_dibits[(data>>4)&0x0F]);
- mask_col = 0xFFu;
+ mask_col = 0xFFFFu;
}
else
- mask_col >>= 8;
+ mask_col >>= 16;
src_col += stride;
dst_col += 2*LCD_WIDTH;
data >>= 8;
}
data |= *src_col << shift;
- mask_bottom &= mask_col;
- if (mask_bottom & 0x0F)
- bfunc(dst_col, lcd_dibits[mask_bottom&0x0F], lcd_dibits[data&0x0F]);
- if (mask_bottom & 0xF0)
- bfunc(dst_col + LCD_WIDTH, lcd_dibits[(mask_bottom&0xF0)>>4],
+ mask_col &= mask_bottom ;
+ if (mask_col & 0xFFu)
+ bfunc(dst_col, mask_col, lcd_dibits[data&0x0F]);
+ if (mask_col & 0xFF00u)
+ bfunc(dst_col + LCD_WIDTH, mask_col >> 8,
lcd_dibits[(data>>4)&0x0F]);
}
while (dst < dst_end);