summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-06-22 00:02:51 +0000
committerJens Arnold <amiconn@rockbox.org>2004-06-22 00:02:51 +0000
commit051e017ab85ed4c29067074649a110349dad7dd9 (patch)
tree7cba897c8209d81871905d0ecf05ea72370d277d
parente6590f1259afe50241c79387cb6dab1ee7a599a0 (diff)
downloadrockbox-051e017ab85ed4c29067074649a110349dad7dd9.tar.gz
rockbox-051e017ab85ed4c29067074649a110349dad7dd9.zip
Slight speedup for drawing 1-bit bitmaps with draw modes 0..2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4784 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/lib/gray.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/plugins/lib/gray.c b/apps/plugins/lib/gray.c
index 1b197c0eeb..e68e5eef7b 100644
--- a/apps/plugins/lib/gray.c
+++ b/apps/plugins/lib/gray.c
@@ -665,6 +665,10 @@ asm (
665 * _writeblock) */ 665 * _writeblock) */
666static void _invertblock(unsigned char *address, unsigned mask, unsigned bits) 666static void _invertblock(unsigned char *address, unsigned mask, unsigned bits)
667{ 667{
668 bits &= mask;
669 if (!bits)
670 return;
671
668 asm volatile ( 672 asm volatile (
669 "mov #0,r1 \n" /* current_plane = 0 */ 673 "mov #0,r1 \n" /* current_plane = 0 */
670 674
@@ -680,7 +684,7 @@ static void _invertblock(unsigned char *address, unsigned mask, unsigned bits)
680 : /* inputs */ 684 : /* inputs */
681 /* %0 */ "r"(graybuf->depth), 685 /* %0 */ "r"(graybuf->depth),
682 /* %1 */ "r"(address), 686 /* %1 */ "r"(address),
683 /* %2 */ "r"(mask & bits), 687 /* %2 */ "r"(bits),
684 /* %3 */ "r"(graybuf->plane_size) 688 /* %3 */ "r"(graybuf->plane_size)
685 : /* clobbers */ 689 : /* clobbers */
686 "r1", "r2", "macl" 690 "r1", "r2", "macl"
@@ -690,13 +694,17 @@ static void _invertblock(unsigned char *address, unsigned mask, unsigned bits)
690/* Call _writeblock with the mask modified to draw foreground pixels only */ 694/* Call _writeblock with the mask modified to draw foreground pixels only */
691static void _writeblockfg(unsigned char *address, unsigned mask, unsigned bits) 695static void _writeblockfg(unsigned char *address, unsigned mask, unsigned bits)
692{ 696{
693 _writeblock(address, mask & bits, bits); 697 mask &= bits;
698 if (mask)
699 _writeblock(address, mask, bits);
694} 700}
695 701
696/* Call _writeblock with the mask modified to draw background pixels only */ 702/* Call _writeblock with the mask modified to draw background pixels only */
697static void _writeblockbg(unsigned char *address, unsigned mask, unsigned bits) 703static void _writeblockbg(unsigned char *address, unsigned mask, unsigned bits)
698{ 704{
699 _writeblock(address, mask & ~bits, bits); 705 mask &= ~bits;
706 if (mask)
707 _writeblock(address, mask, bits);
700} 708}
701 709
702/**** public functions ****/ 710/**** public functions ****/