summaryrefslogtreecommitdiff
path: root/firmware/drivers
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 /firmware/drivers
parentd76c820587d9990c1d3c97fdd68f7345f2072851 (diff)
downloadrockbox-f31e86338aecfdb6fbba4170ea1ba82d0738c7c1.tar.gz
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
Diffstat (limited to 'firmware/drivers')
-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,
719{ 719{
720 int shift, ny; 720 int shift, ny;
721 fb_data *dst, *dst_end; 721 fb_data *dst, *dst_end;
722 unsigned mask, mask_bottom;
722 lcd_blockfunc_type *bfunc; 723 lcd_blockfunc_type *bfunc;
723 724
724 /* nothing to draw? */ 725 /* nothing to draw? */
@@ -754,17 +755,18 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
754 dst = &lcd_framebuffer[y>>2][x]; 755 dst = &lcd_framebuffer[y>>2][x];
755 shift = y & 3; 756 shift = y & 3;
756 ny = height - 1 + shift + src_y; 757 ny = height - 1 + shift + src_y;
758 mask = 0xFFFFu << (2 * (shift + src_y));
759 /* Overflowing bits aren't important. */
760 mask_bottom = 0xFFFFu >> (2 * (~ny & 7));
757 761
758 bfunc = lcd_blockfuncs[current_vp->drawmode]; 762 bfunc = lcd_blockfuncs[current_vp->drawmode];
759 763
760 if (shift == 0) 764 if (shift == 0)
761 { 765 {
762 unsigned dmask1, dmask2, dmask_bottom, data; 766 unsigned dmask1, dmask2, data;
763 767
764 dmask1 = 0xFFFFu << (2 * (shift + src_y)); 768 dmask1 = mask & 0xFFu;
765 dmask2 = dmask1 >> 8; 769 dmask2 = mask >> 8;
766 dmask1 &= 0xFFu;
767 dmask_bottom = 0xFFFFu >> (2 * (~ny & 7));
768 770
769 for (; ny >= 8; ny -= 8) 771 for (; ny >= 8; ny -= 8)
770 { 772 {
@@ -793,9 +795,9 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
793 dst += 2*LCD_WIDTH; 795 dst += 2*LCD_WIDTH;
794 dmask1 = dmask2 = 0xFFu; 796 dmask1 = dmask2 = 0xFFu;
795 } 797 }
796 dmask1 &= dmask_bottom; 798 dmask1 &= mask_bottom;
797 /* & 0xFFu is unnecessary here - dmask1 can't exceed that*/ 799 /* & 0xFFu is unnecessary here - dmask1 can't exceed that*/
798 dmask2 &= (dmask_bottom >> 8); 800 dmask2 &= (mask_bottom >> 8);
799 dst_end = dst + width; 801 dst_end = dst + width;
800 802
801 if (dmask1 != 0) 803 if (dmask1 != 0)
@@ -826,9 +828,6 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
826 } 828 }
827 else 829 else
828 { 830 {
829 unsigned mask = 0xFFu << (shift + src_y);
830 unsigned mask_bottom = 0xFFu >> (~ny & 7);
831
832 dst_end = dst + width; 831 dst_end = dst + width;
833 do 832 do
834 { 833 {
@@ -841,27 +840,27 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
841 { 840 {
842 data |= *src_col << shift; 841 data |= *src_col << shift;
843 842
844 if (mask_col & 0xFFu) 843 if (mask_col & 0xFFFFu)
845 { 844 {
846 if (mask_col & 0x0F) 845 if (mask_col & 0xFFu)
847 bfunc(dst_col, lcd_dibits[mask_col&0x0F], lcd_dibits[data&0x0F]); 846 bfunc(dst_col, mask_col, lcd_dibits[data&0x0F]);
848 bfunc(dst_col + LCD_WIDTH, lcd_dibits[(mask_col>>4)&0x0F], 847 bfunc(dst_col + LCD_WIDTH, mask_col >> 8,
849 lcd_dibits[(data>>4)&0x0F]); 848 lcd_dibits[(data>>4)&0x0F]);
850 mask_col = 0xFFu; 849 mask_col = 0xFFFFu;
851 } 850 }
852 else 851 else
853 mask_col >>= 8; 852 mask_col >>= 16;
854 853
855 src_col += stride; 854 src_col += stride;
856 dst_col += 2*LCD_WIDTH; 855 dst_col += 2*LCD_WIDTH;
857 data >>= 8; 856 data >>= 8;
858 } 857 }
859 data |= *src_col << shift; 858 data |= *src_col << shift;
860 mask_bottom &= mask_col; 859 mask_col &= mask_bottom ;
861 if (mask_bottom & 0x0F) 860 if (mask_col & 0xFFu)
862 bfunc(dst_col, lcd_dibits[mask_bottom&0x0F], lcd_dibits[data&0x0F]); 861 bfunc(dst_col, mask_col, lcd_dibits[data&0x0F]);
863 if (mask_bottom & 0xF0) 862 if (mask_col & 0xFF00u)
864 bfunc(dst_col + LCD_WIDTH, lcd_dibits[(mask_bottom&0xF0)>>4], 863 bfunc(dst_col + LCD_WIDTH, mask_col >> 8,
865 lcd_dibits[(data>>4)&0x0F]); 864 lcd_dibits[(data>>4)&0x0F]);
866 } 865 }
867 while (dst < dst_end); 866 while (dst < dst_end);