summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd.c')
-rw-r--r--firmware/drivers/lcd.c76
1 files changed, 73 insertions, 3 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c
index 3303c16cc4..fa6baf18d9 100644
--- a/firmware/drivers/lcd.c
+++ b/firmware/drivers/lcd.c
@@ -594,7 +594,7 @@ void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
594 { 594 {
595 /* First partial row */ 595 /* First partial row */
596 data = *src++ << shift; 596 data = *src++ << shift;
597 *dst = (*dst & mask) ^ data; 597 *dst = (*dst & mask) | data;
598 data >>= 8; 598 data >>= 8;
599 dst++; 599 dst++;
600 600
@@ -602,7 +602,7 @@ void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
602 for (y = 8; y < ny-8; y += 8) 602 for (y = 8; y < ny-8; y += 8)
603 { 603 {
604 data |= *src++ << shift; 604 data |= *src++ << shift;
605 *dst = (*dst & mask2) ^ data; 605 *dst = (*dst & mask2) | data;
606 data >>= 8; 606 data >>= 8;
607 dst++; 607 dst++;
608 } 608 }
@@ -611,7 +611,7 @@ void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
611 /* Last partial row */ 611 /* Last partial row */
612 if (y + shift < ny) 612 if (y + shift < ny)
613 data |= *src++ << shift; 613 data |= *src++ << shift;
614 *dst = (*dst & mask3) ^ (data & mask4); 614 *dst = (*dst & mask3) | (data & mask4);
615 } 615 }
616} 616}
617 617
@@ -729,6 +729,76 @@ void lcd_drawline( int x1, int y1, int x2, int y2 )
729 } 729 }
730} 730}
731 731
732void lcd_clearline( int x1, int y1, int x2, int y2 )
733{
734 int numpixels;
735 int i;
736 int deltax, deltay;
737 int d, dinc1, dinc2;
738 int x, xinc1, xinc2;
739 int y, yinc1, yinc2;
740
741 deltax = abs(x2 - x1);
742 deltay = abs(y2 - y1);
743
744 if(deltax >= deltay)
745 {
746 numpixels = deltax;
747 d = 2 * deltay - deltax;
748 dinc1 = deltay * 2;
749 dinc2 = (deltay - deltax) * 2;
750 xinc1 = 1;
751 xinc2 = 1;
752 yinc1 = 0;
753 yinc2 = 1;
754 }
755 else
756 {
757 numpixels = deltay;
758 d = 2 * deltax - deltay;
759 dinc1 = deltax * 2;
760 dinc2 = (deltax - deltay) * 2;
761 xinc1 = 0;
762 xinc2 = 1;
763 yinc1 = 1;
764 yinc2 = 1;
765 }
766 numpixels++; /* include endpoints */
767
768 if(x1 > x2)
769 {
770 xinc1 = -xinc1;
771 xinc2 = -xinc2;
772 }
773
774 if(y1 > y2)
775 {
776 yinc1 = -yinc1;
777 yinc2 = -yinc2;
778 }
779
780 x = x1;
781 y = y1;
782
783 for(i=0; i<numpixels; i++)
784 {
785 CLEAR_PIXEL(x,y);
786
787 if(d < 0)
788 {
789 d += dinc1;
790 x += xinc1;
791 y += yinc1;
792 }
793 else
794 {
795 d += dinc2;
796 x += xinc2;
797 y += yinc2;
798 }
799 }
800}
801
732/* 802/*
733 * Set a single pixel 803 * Set a single pixel
734 */ 804 */