diff options
| author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-14 08:15:35 +0000 |
|---|---|---|
| committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-14 08:15:35 +0000 |
| commit | 6e54d94908f9960f9118e18ebb930a769af4922b (patch) | |
| tree | 978fcdcdb3789fe14d591f9b24cf585800075bfd /apps/plugins | |
| parent | d7d75b7fd49f922343be3d4ab6314e499624740d (diff) | |
| download | rockbox-6e54d94908f9960f9118e18ebb930a769af4922b.zip rockbox-6e54d94908f9960f9118e18ebb930a769af4922b.tar.gz rockbox-6e54d94908f9960f9118e18ebb930a769af4922b.tar.bz2 rockbox-6e54d94908f9960f9118e18ebb930a769af4922b.tar.xz | |
reduce pictureflow's fade_color by one multiply, and a few shifts, while still maintaining reasonable quality
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19770 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/pictureflow.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index a355283..739e97c 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c @@ -1067,20 +1067,22 @@ void recalc_table(void) #if (LCD_PIXELFORMAT == RGB565SWAPPED) static inline pix_t fade_color(pix_t c, unsigned int a) { + unsigned int result; c = swap16(c); - unsigned int result=0; - result |= (((c & 0x1f) * a) >> 8) & 0x1f; - result |= (((c & 0x7e0) * a) >> 8) & 0x7e0; - result |= (((c & 0xf800) * a) >> 8) & 0xf800; + a = (a + 2) & 0x1fc; + result = ((c & 0xf81f) * a) & 0xf81f00; + result |= ((c & 0x7e0) * a) & 0x7e000; + result >>= 8; return swap16(result); } #elif LCD_PIXELFORMAT == RGB565 static inline pix_t fade_color(pix_t c, unsigned int a) { - unsigned int result=0; - result |= (((c & 0x1f) * a) >> 8) & 0x1f; - result |= (((c & 0x7e0) * a) >> 8) & 0x7e0; - result |= (((c & 0xf800) * a) >> 8) & 0xf800; + unsigned int result; + a = (a + 2) & 0x1fc; + result = ((c & 0xf81f) * a) & 0xf81f00; + result |= ((c & 0x7e0) * a) & 0x7e000; + result >>= 8; return result; } #else |