summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-2bit-vert.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-05-30 23:35:44 +0000
committerJens Arnold <amiconn@rockbox.org>2009-05-30 23:35:44 +0000
commit72061047d1cbe2f9c8728d1cde302343bb8dd784 (patch)
tree548cd4fa407553680023940b59ef883377e5eac3 /firmware/drivers/lcd-2bit-vert.c
parent294ece8bd6189555b1a3164d216196d992982eab (diff)
downloadrockbox-72061047d1cbe2f9c8728d1cde302343bb8dd784.tar.gz
rockbox-72061047d1cbe2f9c8728d1cde302343bb8dd784.zip
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
Diffstat (limited to 'firmware/drivers/lcd-2bit-vert.c')
-rw-r--r--firmware/drivers/lcd-2bit-vert.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c
index d12ebbc975..cff5eaffb1 100644
--- a/firmware/drivers/lcd-2bit-vert.c
+++ b/firmware/drivers/lcd-2bit-vert.c
@@ -719,7 +719,6 @@ 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;
723 lcd_blockfunc_type *bfunc; 722 lcd_blockfunc_type *bfunc;
724 723
725 /* nothing to draw? */ 724 /* nothing to draw? */
@@ -757,20 +756,21 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
757 ny = height - 1 + shift + src_y; 756 ny = height - 1 + shift + src_y;
758 757
759 bfunc = lcd_blockfuncs[current_vp->drawmode]; 758 bfunc = lcd_blockfuncs[current_vp->drawmode];
760 mask = 0xFFu << (shift + src_y);
761 mask_bottom = 0xFFu >> (~ny & 7);
762 759
763 if (shift == 0) 760 if (shift == 0)
764 { 761 {
765 unsigned dmask1, dmask2, data; 762 unsigned dmask1, dmask2, dmask_bottom, data;
763
764 dmask1 = 0xFFFFu << (2 * (shift + src_y));
765 dmask2 = dmask1 >> 8;
766 dmask1 &= 0xFFu;
767 dmask_bottom = 0xFFFFu >> (2 * (~ny & 7));
766 768
767 for (; ny >= 8; ny -= 8) 769 for (; ny >= 8; ny -= 8)
768 { 770 {
769 const unsigned char *src_row = src; 771 const unsigned char *src_row = src;
770 fb_data *dst_row = dst + LCD_WIDTH; 772 fb_data *dst_row = dst + LCD_WIDTH;
771 773
772 dmask1 = lcd_dibits[mask&0x0F];
773 dmask2 = lcd_dibits[(mask>>4)&0x0F];
774 dst_end = dst_row + width; 774 dst_end = dst_row + width;
775 775
776 if (dmask1 != 0) 776 if (dmask1 != 0)
@@ -791,11 +791,11 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
791 } 791 }
792 src += stride; 792 src += stride;
793 dst += 2*LCD_WIDTH; 793 dst += 2*LCD_WIDTH;
794 mask = 0xFFu; 794 dmask1 = dmask2 = 0xFFu;
795 } 795 }
796 mask &= mask_bottom; 796 dmask1 &= dmask_bottom;
797 dmask1 = lcd_dibits[mask&0x0F]; 797 /* & 0xFFu is unnecessary here - dmask1 can't exceed that*/
798 dmask2 = lcd_dibits[(mask>>4)&0x0F]; 798 dmask2 &= (dmask_bottom >> 8);
799 dst_end = dst + width; 799 dst_end = dst + width;
800 800
801 if (dmask1 != 0) 801 if (dmask1 != 0)
@@ -826,6 +826,9 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
826 } 826 }
827 else 827 else
828 { 828 {
829 unsigned mask = 0xFFu << (shift + src_y);
830 unsigned mask_bottom = 0xFFu >> (~ny & 7);
831
829 dst_end = dst + width; 832 dst_end = dst + width;
830 do 833 do
831 { 834 {