summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-2bit-horz.c10
-rw-r--r--firmware/drivers/lcd-2bit-vert.c23
2 files changed, 17 insertions, 16 deletions
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index a9a691cabd..4dc82deae0 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -732,9 +732,8 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
732 do 732 do
733 { 733 {
734 const unsigned char *src_col = src++; 734 const unsigned char *src_col = src++;
735 unsigned data = *src_col >> src_y; 735 unsigned data = (*src_col | 0x100) >> src_y; /* bit 8 == sentinel */
736 int numbits = 8 - ((int)src_y); 736
737
738 ymax = y + height; 737 ymax = y + height;
739 ny = y; 738 ny = y;
740 do 739 do
@@ -747,11 +746,10 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
747 ny++; 746 ny++;
748 747
749 data >>= 1; 748 data >>= 1;
750 if (--numbits == 0) 749 if (data == 0x001)
751 { 750 {
752 src_col += stride; 751 src_col += stride;
753 data = *src_col; 752 data = *src_col | 0x100;
754 numbits = 8;
755 } 753 }
756 } 754 }
757 while (ny < ymax); 755 while (ny < ymax);
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 {