1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2005-07-27 19:58:49 +00:00
parent 988ea2cffc
commit 00866dbf86
6 changed files with 618 additions and 216 deletions

View file

@ -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 */