diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2005-07-27 19:58:49 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2005-07-27 19:58:49 +0000 |
| commit | 00866dbf86ad9fe3a65c94d2f7b5b0052a7e2738 (patch) | |
| tree | 912a697982bba1d34ef484a574fe57695cbbcf57 /apps/plugins/lib/gray_parm.c | |
| parent | 988ea2cffc36d891d5b4752484c741a98eddede3 (diff) | |
| download | rockbox-00866dbf86ad9fe3a65c94d2f7b5b0052a7e2738.zip rockbox-00866dbf86ad9fe3a65c94d2f7b5b0052a7e2738.tar.gz rockbox-00866dbf86ad9fe3a65c94d2f7b5b0052a7e2738.tar.bz2 rockbox-00866dbf86ad9fe3a65c94d2f7b5b0052a7e2738.tar.xz | |
Grayscale library: (1) Ported to iriver H1x0. Experiments have shown that the intended 49-shade mode isn't possible due to interference between the internal greylevel generation of the LCD and external pixel flipping, so the lib allows 33 shades as on the Archos. The current implementation wastes RAM by not switching the LCD to b&w mode and simply using colours 0 and 3 only. However, this allows to show a partial greyscale overlay and normal 4-shade graphics in parallel. (2) Converted all asm blocks to use symbolic parameters. (3) Properly marked asm input parameters that are changed within the block as in-out and feed them from a temp variable where necessary. (4) Screenshot is not yet working on H1x0.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7244 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/gray_parm.c')
| -rw-r--r-- | apps/plugins/lib/gray_parm.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/plugins/lib/gray_parm.c b/apps/plugins/lib/gray_parm.c index c66cc33..a8c238a 100644 --- a/apps/plugins/lib/gray_parm.c +++ b/apps/plugins/lib/gray_parm.c @@ -55,7 +55,7 @@ int gray_get_drawmode(void) /* Set the foreground shade for subsequent drawing operations */ void gray_set_foreground(int brightness) { - unsigned data = MULU16(_LEVEL_FAC * _gray_info.depth, brightness & 0xFF) + 127; + unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127; _gray_info.fg_brightness = (data + (data >> 8)) >> 8; /* approx. data / 255 */ } @@ -63,14 +63,14 @@ void gray_set_foreground(int brightness) /* Return the current foreground shade */ int gray_get_foreground(void) { - return (_gray_info.fg_brightness * 255 + ((_LEVEL_FAC * _gray_info.depth) >> 1)) - / (_LEVEL_FAC * _gray_info.depth); + return (_gray_info.fg_brightness * 255 + (_gray_info.depth >> 1)) + / _gray_info.depth; } /* Set the background shade for subsequent drawing operations */ void gray_set_background(int brightness) { - unsigned data = MULU16(_LEVEL_FAC * _gray_info.depth, brightness & 0xFF) + 127; + unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127; _gray_info.bg_brightness = (data + (data >> 8)) >> 8; /* approx. data / 255 */ } @@ -78,8 +78,8 @@ void gray_set_background(int brightness) /* Return the current background shade */ int gray_get_background(void) { - return (_gray_info.bg_brightness * 255 + ((_LEVEL_FAC * _gray_info.depth) >> 1)) - / (_LEVEL_FAC * _gray_info.depth); + return (_gray_info.bg_brightness * 255 + (_gray_info.depth >> 1)) + / _gray_info.depth; } /* Set draw mode, foreground and background shades at once */ |