summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/gray_parm.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-08-02 00:22:01 +0000
committerJens Arnold <amiconn@rockbox.org>2006-08-02 00:22:01 +0000
commit628d20a6109bf65175e7c4b1bd9477cdccfd7437 (patch)
treea5bdef444b5873a4d24421dcfaf4f94dedbec38c /apps/plugins/lib/gray_parm.c
parent8cc73f152b510c946a0285ac010639ebd6668ebc (diff)
downloadrockbox-628d20a6109bf65175e7c4b1bd9477cdccfd7437.zip
rockbox-628d20a6109bf65175e7c4b1bd9477cdccfd7437.tar.gz
rockbox-628d20a6109bf65175e7c4b1bd9477cdccfd7437.tar.bz2
rockbox-628d20a6109bf65175e7c4b1bd9477cdccfd7437.tar.xz
Grayscale library: LCD linearisation and gamma correction.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10402 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/gray_parm.c')
-rw-r--r--apps/plugins/lib/gray_parm.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/apps/plugins/lib/gray_parm.c b/apps/plugins/lib/gray_parm.c
index c630542..a6064e3 100644
--- a/apps/plugins/lib/gray_parm.c
+++ b/apps/plugins/lib/gray_parm.c
@@ -61,31 +61,27 @@ int gray_get_drawmode(void)
/* Set the foreground shade for subsequent drawing operations */
void gray_set_foreground(unsigned brightness)
{
- unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127;
-
- _gray_info.fg_brightness = (data + (data >> 8)) >> 8; /* approx. data / 255 */
+ _gray_info.fg_brightness = brightness;
+ _gray_info.fg_index = _gray_info.idxtable[brightness];
}
/* Return the current foreground shade */
unsigned gray_get_foreground(void)
{
- return (_gray_info.fg_brightness * 255 + (_gray_info.depth >> 1))
- / _gray_info.depth;
+ return _gray_info.fg_brightness;
}
/* Set the background shade for subsequent drawing operations */
void gray_set_background(unsigned brightness)
{
- unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127;
-
- _gray_info.bg_brightness = (data + (data >> 8)) >> 8; /* approx. data / 255 */
+ _gray_info.bg_brightness = brightness;
+ _gray_info.bg_index = _gray_info.idxtable[brightness];
}
/* Return the current background shade */
unsigned gray_get_background(void)
{
- return (_gray_info.bg_brightness * 255 + (_gray_info.depth >> 1))
- / _gray_info.depth;
+ return _gray_info.bg_brightness;
}
/* Set draw mode, foreground and background shades at once */