From 051e017ab85ed4c29067074649a110349dad7dd9 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Tue, 22 Jun 2004 00:02:51 +0000 Subject: 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 --- apps/plugins/lib/gray.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'apps/plugins/lib/gray.c') 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 ( * _writeblock) */ static void _invertblock(unsigned char *address, unsigned mask, unsigned bits) { + bits &= mask; + if (!bits) + return; + asm volatile ( "mov #0,r1 \n" /* current_plane = 0 */ @@ -680,7 +684,7 @@ static void _invertblock(unsigned char *address, unsigned mask, unsigned bits) : /* inputs */ /* %0 */ "r"(graybuf->depth), /* %1 */ "r"(address), - /* %2 */ "r"(mask & bits), + /* %2 */ "r"(bits), /* %3 */ "r"(graybuf->plane_size) : /* clobbers */ "r1", "r2", "macl" @@ -690,13 +694,17 @@ static void _invertblock(unsigned char *address, unsigned mask, unsigned bits) /* Call _writeblock with the mask modified to draw foreground pixels only */ static void _writeblockfg(unsigned char *address, unsigned mask, unsigned bits) { - _writeblock(address, mask & bits, bits); + mask &= bits; + if (mask) + _writeblock(address, mask, bits); } /* Call _writeblock with the mask modified to draw background pixels only */ static void _writeblockbg(unsigned char *address, unsigned mask, unsigned bits) { - _writeblock(address, mask & ~bits, bits); + mask &= ~bits; + if (mask) + _writeblock(address, mask, bits); } /**** public functions ****/ -- cgit v1.2.3