diff options
Diffstat (limited to 'firmware/drivers/lcd-h100.c')
-rw-r--r-- | firmware/drivers/lcd-h100.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c index 3d858e2271..379838d068 100644 --- a/firmware/drivers/lcd-h100.c +++ b/firmware/drivers/lcd-h100.c | |||
@@ -492,7 +492,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
492 | void lcd_hline(int x1, int x2, int y) | 492 | void lcd_hline(int x1, int x2, int y) |
493 | { | 493 | { |
494 | int x; | 494 | int x; |
495 | unsigned char *dst; | 495 | unsigned char *dst, *dst_end; |
496 | unsigned mask; | 496 | unsigned mask; |
497 | lcd_blockfunc_type *bfunc; | 497 | lcd_blockfunc_type *bfunc; |
498 | 498 | ||
@@ -518,8 +518,10 @@ void lcd_hline(int x1, int x2, int y) | |||
518 | dst = &lcd_framebuffer[y>>3][x1]; | 518 | dst = &lcd_framebuffer[y>>3][x1]; |
519 | mask = 1 << (y & 7); | 519 | mask = 1 << (y & 7); |
520 | 520 | ||
521 | for (x = x1; x <= x2; x++) | 521 | dst_end = dst + x2 - x1; |
522 | do | ||
522 | bfunc(dst++, mask, 0xFFu); | 523 | bfunc(dst++, mask, 0xFFu); |
524 | while (dst <= dst_end); | ||
523 | } | 525 | } |
524 | 526 | ||
525 | /* Draw a vertical line (optimised) */ | 527 | /* Draw a vertical line (optimised) */ |
@@ -582,8 +584,8 @@ void lcd_drawrect(int x, int y, int width, int height) | |||
582 | /* Fill a rectangular area */ | 584 | /* Fill a rectangular area */ |
583 | void lcd_fillrect(int x, int y, int width, int height) | 585 | void lcd_fillrect(int x, int y, int width, int height) |
584 | { | 586 | { |
585 | int ny, i; | 587 | int ny; |
586 | unsigned char *dst; | 588 | unsigned char *dst, *dst_end; |
587 | unsigned mask, mask_bottom; | 589 | unsigned mask, mask_bottom; |
588 | unsigned bits = 0xFFu; | 590 | unsigned bits = 0xFFu; |
589 | lcd_blockfunc_type *bfunc; | 591 | lcd_blockfunc_type *bfunc; |
@@ -628,8 +630,10 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
628 | { | 630 | { |
629 | unsigned char *dst_row = dst; | 631 | unsigned char *dst_row = dst; |
630 | 632 | ||
631 | for (i = width; i > 0; i--) | 633 | dst_end = dst_row + width; |
634 | do | ||
632 | bfunc(dst_row++, mask, 0xFFu); | 635 | bfunc(dst_row++, mask, 0xFFu); |
636 | while (dst_row < dst_end); | ||
633 | } | 637 | } |
634 | 638 | ||
635 | dst += LCD_WIDTH; | 639 | dst += LCD_WIDTH; |
@@ -641,8 +645,10 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
641 | memset(dst, bits, width); | 645 | memset(dst, bits, width); |
642 | else | 646 | else |
643 | { | 647 | { |
644 | for (i = width; i > 0; i--) | 648 | dst_end = dst + width; |
649 | do | ||
645 | bfunc(dst++, mask, 0xFFu); | 650 | bfunc(dst++, mask, 0xFFu); |
651 | while (dst < dst_end); | ||
646 | } | 652 | } |
647 | } | 653 | } |
648 | 654 | ||
@@ -664,8 +670,8 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
664 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | 670 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, |
665 | int stride, int x, int y, int width, int height) | 671 | int stride, int x, int y, int width, int height) |
666 | { | 672 | { |
667 | int shift, ny, i; | 673 | int shift, ny; |
668 | unsigned char *dst; | 674 | unsigned char *dst, *dst_end; |
669 | unsigned mask, mask_bottom; | 675 | unsigned mask, mask_bottom; |
670 | lcd_blockfunc_type *bfunc; | 676 | lcd_blockfunc_type *bfunc; |
671 | 677 | ||
@@ -716,8 +722,10 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
716 | const unsigned char *src_row = src; | 722 | const unsigned char *src_row = src; |
717 | unsigned char *dst_row = dst; | 723 | unsigned char *dst_row = dst; |
718 | 724 | ||
719 | for (i = width; i > 0; i--) | 725 | dst_end = dst_row + width; |
726 | do | ||
720 | bfunc(dst_row++, mask, *src_row++); | 727 | bfunc(dst_row++, mask, *src_row++); |
728 | while (dst_row < dst_end); | ||
721 | } | 729 | } |
722 | 730 | ||
723 | src += stride; | 731 | src += stride; |
@@ -730,13 +738,16 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
730 | memcpy(dst, src, width); | 738 | memcpy(dst, src, width); |
731 | else | 739 | else |
732 | { | 740 | { |
733 | for (i = width; i > 0; i--) | 741 | dst_end = dst + width; |
742 | do | ||
734 | bfunc(dst++, mask, *src++); | 743 | bfunc(dst++, mask, *src++); |
744 | while (dst < dst_end); | ||
735 | } | 745 | } |
736 | } | 746 | } |
737 | else | 747 | else |
738 | { | 748 | { |
739 | for (x = 0; x < width; x++) | 749 | dst_end = dst + width; |
750 | do | ||
740 | { | 751 | { |
741 | const unsigned char *src_col = src++; | 752 | const unsigned char *src_col = src++; |
742 | unsigned char *dst_col = dst++; | 753 | unsigned char *dst_col = dst++; |
@@ -762,6 +773,7 @@ void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
762 | data |= *src_col << shift; | 773 | data |= *src_col << shift; |
763 | bfunc(dst_col, mask_col & mask_bottom, data); | 774 | bfunc(dst_col, mask_col & mask_bottom, data); |
764 | } | 775 | } |
776 | while (dst < dst_end); | ||
765 | } | 777 | } |
766 | } | 778 | } |
767 | 779 | ||