diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-07-02 07:21:21 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-07-02 07:21:21 +0000 |
commit | 3291ae6bfac7a0cd39dafe12b006f73cbcb874d1 (patch) | |
tree | 3ddbd67cc25fd390e62708bbdd00dd115fbdb9b6 | |
parent | 876a044ae054fb85d3290b8e457faa2271f3d9f5 (diff) | |
download | rockbox-3291ae6bfac7a0cd39dafe12b006f73cbcb874d1.tar.gz rockbox-3291ae6bfac7a0cd39dafe12b006f73cbcb874d1.zip |
A couple of optimisations.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6981 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/lib/playergfx.c | 27 | ||||
-rw-r--r-- | firmware/drivers/lcd-h100-remote.c | 34 | ||||
-rw-r--r-- | firmware/drivers/lcd-h100.c | 34 | ||||
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 36 |
4 files changed, 87 insertions, 44 deletions
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c index 5b756a7727..87be782d4d 100644 --- a/apps/plugins/lib/playergfx.c +++ b/apps/plugins/lib/playergfx.c | |||
@@ -317,7 +317,7 @@ void pgfx_hline(int x1, int x2, int y) | |||
317 | void pgfx_vline(int x, int y1, int y2) | 317 | void pgfx_vline(int x, int y1, int y2) |
318 | { | 318 | { |
319 | int y; | 319 | int y; |
320 | unsigned char *dst; | 320 | unsigned char *dst, *dst_end; |
321 | unsigned mask; | 321 | unsigned mask; |
322 | lcd_blockfunc_type *bfunc; | 322 | lcd_blockfunc_type *bfunc; |
323 | 323 | ||
@@ -344,8 +344,10 @@ void pgfx_vline(int x, int y1, int y2) | |||
344 | dst = &gfx_buffer[pixel_height * (x/5) + y1]; | 344 | dst = &gfx_buffer[pixel_height * (x/5) + y1]; |
345 | mask = 0x10 >> (x % 5); | 345 | mask = 0x10 >> (x % 5); |
346 | 346 | ||
347 | for (y = y1; y <= y2; y++) | 347 | dst_end = dst + y2 - y1; |
348 | do | ||
348 | bfunc(dst++, mask, 0x1F); | 349 | bfunc(dst++, mask, 0x1F); |
350 | while (dst <= dst_end); | ||
349 | } | 351 | } |
350 | 352 | ||
351 | /* Draw a rectangular box */ | 353 | /* Draw a rectangular box */ |
@@ -366,8 +368,8 @@ void pgfx_drawrect(int x, int y, int width, int height) | |||
366 | /* Fill a rectangular area */ | 368 | /* Fill a rectangular area */ |
367 | void pgfx_fillrect(int x, int y, int width, int height) | 369 | void pgfx_fillrect(int x, int y, int width, int height) |
368 | { | 370 | { |
369 | int nx, i; | 371 | int nx; |
370 | unsigned char *dst; | 372 | unsigned char *dst, *dst_end; |
371 | unsigned mask, mask_right; | 373 | unsigned mask, mask_right; |
372 | lcd_blockfunc_type *bfunc; | 374 | lcd_blockfunc_type *bfunc; |
373 | 375 | ||
@@ -402,16 +404,20 @@ void pgfx_fillrect(int x, int y, int width, int height) | |||
402 | { | 404 | { |
403 | unsigned char *dst_col = dst; | 405 | unsigned char *dst_col = dst; |
404 | 406 | ||
405 | for (i = height; i > 0; i--) | 407 | dst_end = dst_col + height; |
408 | do | ||
406 | bfunc(dst_col++, mask, 0x1F); | 409 | bfunc(dst_col++, mask, 0x1F); |
410 | while (dst_col < dst_end); | ||
407 | 411 | ||
408 | dst += pixel_height; | 412 | dst += pixel_height; |
409 | mask = 0x1F; | 413 | mask = 0x1F; |
410 | } | 414 | } |
411 | mask &= mask_right; | 415 | mask &= mask_right; |
412 | 416 | ||
413 | for (i = height; i > 0; i--) | 417 | dst_end = dst + height; |
418 | do | ||
414 | bfunc(dst++, mask, 0x1F); | 419 | bfunc(dst++, mask, 0x1F); |
420 | while (dst < dst_end); | ||
415 | } | 421 | } |
416 | 422 | ||
417 | /* About PlayerGFX internal bitmap format: | 423 | /* About PlayerGFX internal bitmap format: |
@@ -429,7 +435,7 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
429 | int stride, int x, int y, int width, int height) | 435 | int stride, int x, int y, int width, int height) |
430 | { | 436 | { |
431 | int nx, shift; | 437 | int nx, shift; |
432 | unsigned char *dst; | 438 | unsigned char *dst, *dst_end; |
433 | unsigned mask, mask_right; | 439 | unsigned mask, mask_right; |
434 | lcd_blockfunc_type *bfunc; | 440 | lcd_blockfunc_type *bfunc; |
435 | 441 | ||
@@ -465,10 +471,11 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
465 | mask = 0x1F >> (x % 5); | 471 | mask = 0x1F >> (x % 5); |
466 | mask_right = 0x1F0 >> (nx % 5); | 472 | mask_right = 0x1F0 >> (nx % 5); |
467 | 473 | ||
468 | for (y = 0; y < height; y++) | 474 | dst_end = dst + height; |
475 | do | ||
469 | { | 476 | { |
470 | const unsigned char *src_row = src; | 477 | const unsigned char *src_row = src; |
471 | unsigned char *dst_row = dst; | 478 | unsigned char *dst_row = dst++; |
472 | unsigned mask_row = mask; | 479 | unsigned mask_row = mask; |
473 | unsigned data = *src_row++; | 480 | unsigned data = *src_row++; |
474 | int extrabits = shift; | 481 | int extrabits = shift; |
@@ -493,8 +500,8 @@ void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
493 | bfunc(dst_row, mask_row & mask_right, data >> extrabits); | 500 | bfunc(dst_row, mask_row & mask_right, data >> extrabits); |
494 | 501 | ||
495 | src += stride; | 502 | src += stride; |
496 | dst++; | ||
497 | } | 503 | } |
504 | while (dst < dst_end); | ||
498 | } | 505 | } |
499 | 506 | ||
500 | /* Draw a full bitmap */ | 507 | /* Draw a full bitmap */ |
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index 8112aecdb1..af6a45c2c0 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c | |||
@@ -653,7 +653,7 @@ void lcd_remote_drawline(int x1, int y1, int x2, int y2) | |||
653 | void lcd_remote_hline(int x1, int x2, int y) | 653 | void lcd_remote_hline(int x1, int x2, int y) |
654 | { | 654 | { |
655 | int x; | 655 | int x; |
656 | unsigned char *dst; | 656 | unsigned char *dst, *dst_end; |
657 | unsigned mask; | 657 | unsigned mask; |
658 | lcd_blockfunc_type *bfunc; | 658 | lcd_blockfunc_type *bfunc; |
659 | 659 | ||
@@ -680,8 +680,10 @@ void lcd_remote_hline(int x1, int x2, int y) | |||
680 | dst = &lcd_remote_framebuffer[y>>3][x1]; | 680 | dst = &lcd_remote_framebuffer[y>>3][x1]; |
681 | mask = 1 << (y & 7); | 681 | mask = 1 << (y & 7); |
682 | 682 | ||
683 | for (x = x1; x <= x2; x++) | 683 | dst_end = dst + x2 - x1; |
684 | do | ||
684 | bfunc(dst++, mask, 0xFFu); | 685 | bfunc(dst++, mask, 0xFFu); |
686 | while (dst <= dst_end); | ||
685 | } | 687 | } |
686 | 688 | ||
687 | /* Draw a vertical line (optimised) */ | 689 | /* Draw a vertical line (optimised) */ |
@@ -745,8 +747,8 @@ void lcd_remote_drawrect(int x, int y, int width, int height) | |||
745 | /* Fill a rectangular area */ | 747 | /* Fill a rectangular area */ |
746 | void lcd_remote_fillrect(int x, int y, int width, int height) | 748 | void lcd_remote_fillrect(int x, int y, int width, int height) |
747 | { | 749 | { |
748 | int ny, i; | 750 | int ny; |
749 | unsigned char *dst; | 751 | unsigned char *dst, *dst_end; |
750 | unsigned mask, mask_bottom; | 752 | unsigned mask, mask_bottom; |
751 | unsigned bits = 0xFFu; | 753 | unsigned bits = 0xFFu; |
752 | lcd_blockfunc_type *bfunc; | 754 | lcd_blockfunc_type *bfunc; |
@@ -791,8 +793,10 @@ void lcd_remote_fillrect(int x, int y, int width, int height) | |||
791 | { | 793 | { |
792 | unsigned char *dst_row = dst; | 794 | unsigned char *dst_row = dst; |
793 | 795 | ||
794 | for (i = width; i > 0; i--) | 796 | dst_end = dst_row + width; |
797 | do | ||
795 | bfunc(dst_row++, mask, 0xFFu); | 798 | bfunc(dst_row++, mask, 0xFFu); |
799 | while (dst_row < dst_end); | ||
796 | } | 800 | } |
797 | 801 | ||
798 | dst += LCD_REMOTE_WIDTH; | 802 | dst += LCD_REMOTE_WIDTH; |
@@ -804,8 +808,10 @@ void lcd_remote_fillrect(int x, int y, int width, int height) | |||
804 | memset(dst, bits, width); | 808 | memset(dst, bits, width); |
805 | else | 809 | else |
806 | { | 810 | { |
807 | for (i = width; i > 0; i--) | 811 | dst_end = dst + width; |
812 | do | ||
808 | bfunc(dst++, mask, 0xFFu); | 813 | bfunc(dst++, mask, 0xFFu); |
814 | while (dst < dst_end); | ||
809 | } | 815 | } |
810 | } | 816 | } |
811 | 817 | ||
@@ -827,8 +833,8 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
827 | void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, | 833 | void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, |
828 | int stride, int x, int y, int width, int height) | 834 | int stride, int x, int y, int width, int height) |
829 | { | 835 | { |
830 | int shift, ny, i; | 836 | int shift, ny; |
831 | unsigned char *dst; | 837 | unsigned char *dst, *dst_end; |
832 | unsigned mask, mask_bottom; | 838 | unsigned mask, mask_bottom; |
833 | lcd_blockfunc_type *bfunc; | 839 | lcd_blockfunc_type *bfunc; |
834 | 840 | ||
@@ -879,8 +885,10 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
879 | const unsigned char *src_row = src; | 885 | const unsigned char *src_row = src; |
880 | unsigned char *dst_row = dst; | 886 | unsigned char *dst_row = dst; |
881 | 887 | ||
882 | for (i = width; i > 0; i--) | 888 | dst_end = dst_row + width; |
889 | do | ||
883 | bfunc(dst_row++, mask, *src_row++); | 890 | bfunc(dst_row++, mask, *src_row++); |
891 | while (dst_row < dst_end); | ||
884 | } | 892 | } |
885 | 893 | ||
886 | src += stride; | 894 | src += stride; |
@@ -893,13 +901,16 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
893 | memcpy(dst, src, width); | 901 | memcpy(dst, src, width); |
894 | else | 902 | else |
895 | { | 903 | { |
896 | for (i = width; i > 0; i--) | 904 | dst_end = dst + width; |
905 | do | ||
897 | bfunc(dst++, mask, *src++); | 906 | bfunc(dst++, mask, *src++); |
907 | while (dst < dst_end); | ||
898 | } | 908 | } |
899 | } | 909 | } |
900 | else | 910 | else |
901 | { | 911 | { |
902 | for (x = 0; x < width; x++) | 912 | dst_end = dst + width; |
913 | do | ||
903 | { | 914 | { |
904 | const unsigned char *src_col = src++; | 915 | const unsigned char *src_col = src++; |
905 | unsigned char *dst_col = dst++; | 916 | unsigned char *dst_col = dst++; |
@@ -925,6 +936,7 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
925 | data |= *src_col << shift; | 936 | data |= *src_col << shift; |
926 | bfunc(dst_col, mask_col & mask_bottom, data); | 937 | bfunc(dst_col, mask_col & mask_bottom, data); |
927 | } | 938 | } |
939 | while (dst < dst_end); | ||
928 | } | 940 | } |
929 | } | 941 | } |
930 | 942 | ||
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 | ||
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 | ||