diff options
Diffstat (limited to 'firmware/drivers/lcd-recorder.c')
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index f933e6ca5c..b857708514 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c | |||
@@ -549,7 +549,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
549 | void lcd_hline(int x1, int x2, int y) | 549 | void lcd_hline(int x1, int x2, int y) |
550 | { | 550 | { |
551 | int x; | 551 | int x; |
552 | unsigned char *dst; | 552 | unsigned char *dst, *dst_end; |
553 | unsigned mask; | 553 | unsigned mask; |
554 | lcd_blockfunc_type *bfunc; | 554 | lcd_blockfunc_type *bfunc; |
555 | 555 | ||
@@ -575,8 +575,10 @@ void lcd_hline(int x1, int x2, int y) | |||
575 | dst = &lcd_framebuffer[y>>3][x1]; | 575 | dst = &lcd_framebuffer[y>>3][x1]; |
576 | mask = 1 << (y & 7); | 576 | mask = 1 << (y & 7); |
577 | 577 | ||
578 | for (x = x1; x <= x2; x++) | 578 | dst_end = dst + x2 - x1; |
579 | do | ||
579 | bfunc(dst++, mask, 0xFFu); | 580 | bfunc(dst++, mask, 0xFFu); |
581 | while (dst <= dst_end); | ||
580 | } | 582 | } |
581 | 583 | ||
582 | /* Draw a vertical line (optimised) */ | 584 | /* Draw a vertical line (optimised) */ |
@@ -639,8 +641,8 @@ void lcd_drawrect(int x, int y, int width, int height) | |||
639 | /* Fill a rectangular area */ | 641 | /* Fill a rectangular area */ |
640 | void lcd_fillrect(int x, int y, int width, int height) | 642 | void lcd_fillrect(int x, int y, int width, int height) |
641 | { | 643 | { |
642 | int ny, i; | 644 | int ny; |
643 | unsigned char *dst; | 645 | unsigned char *dst, *dst_end; |
644 | unsigned mask, mask_bottom; | 646 | unsigned mask, mask_bottom; |
645 | unsigned bits = 0xFFu; | 647 | unsigned bits = 0xFFu; |
646 | lcd_blockfunc_type *bfunc; | 648 | lcd_blockfunc_type *bfunc; |
@@ -685,8 +687,10 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
685 | { | 687 | { |
686 | unsigned char *dst_row = dst; | 688 | unsigned char *dst_row = dst; |
687 | 689 | ||
688 | for (i = width; i > 0; i--) | 690 | dst_end = dst_row + width; |
691 | do | ||
689 | bfunc(dst_row++, mask, 0xFFu); | 692 | bfunc(dst_row++, mask, 0xFFu); |
693 | while (dst_row < dst_end); | ||
690 | } | 694 | } |
691 | 695 | ||
692 | dst += LCD_WIDTH; | 696 | dst += LCD_WIDTH; |
@@ -698,8 +702,10 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
698 | memset(dst, bits, width); | 702 | memset(dst, bits, width); |
699 | else | 703 | else |
700 | { | 704 | { |
701 | for (i = width; i > 0; i--) | 705 | dst_end = dst + width; |
706 | do | ||
702 | bfunc(dst++, mask, 0xFFu); | 707 | bfunc(dst++, mask, 0xFFu); |
708 | while (dst < dst_end); | ||
703 | } | 709 | } |
704 | } | 710 | } |
705 | 711 | ||
@@ -721,8 +727,8 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
721 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | 727 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, |
722 | int stride, int x, int y, int width, int height) | 728 | int stride, int x, int y, int width, int height) |
723 | { | 729 | { |
724 | int shift, ny, i; | 730 | int shift, ny; |
725 | unsigned char *dst; | 731 | unsigned char *dst, *dst_end; |
726 | unsigned mask, mask_bottom; | 732 | unsigned mask, mask_bottom; |
727 | lcd_blockfunc_type *bfunc; | 733 | lcd_blockfunc_type *bfunc; |
728 | 734 | ||
@@ -772,9 +778,11 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
772 | { | 778 | { |
773 | const unsigned char *src_row = src; | 779 | const unsigned char *src_row = src; |
774 | unsigned char *dst_row = dst; | 780 | unsigned char *dst_row = dst; |
775 | 781 | ||
776 | for (i = width; i > 0; i--) | 782 | dst_end = dst_row + width; |
783 | do | ||
777 | bfunc(dst_row++, mask, *src_row++); | 784 | bfunc(dst_row++, mask, *src_row++); |
785 | while (dst_row < dst_end); | ||
778 | } | 786 | } |
779 | 787 | ||
780 | src += stride; | 788 | src += stride; |
@@ -787,13 +795,16 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
787 | memcpy(dst, src, width); | 795 | memcpy(dst, src, width); |
788 | else | 796 | else |
789 | { | 797 | { |
790 | for (i = width; i > 0; i--) | 798 | dst_end = dst + width; |
799 | do | ||
791 | bfunc(dst++, mask, *src++); | 800 | bfunc(dst++, mask, *src++); |
801 | while (dst < dst_end); | ||
792 | } | 802 | } |
793 | } | 803 | } |
794 | else | 804 | else |
795 | { | 805 | { |
796 | for (x = 0; x < width; x++) | 806 | dst_end = dst + width; |
807 | do | ||
797 | { | 808 | { |
798 | const unsigned char *src_col = src++; | 809 | const unsigned char *src_col = src++; |
799 | unsigned char *dst_col = dst++; | 810 | unsigned char *dst_col = dst++; |
@@ -819,6 +830,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
819 | data |= *src_col << shift; | 830 | data |= *src_col << shift; |
820 | bfunc(dst_col, mask_col & mask_bottom, data); | 831 | bfunc(dst_col, mask_col & mask_bottom, data); |
821 | } | 832 | } |
833 | while (dst < dst_end); | ||
822 | } | 834 | } |
823 | } | 835 | } |
824 | 836 | ||