diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-08-02 00:22:01 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-08-02 00:22:01 +0000 |
commit | 628d20a6109bf65175e7c4b1bd9477cdccfd7437 (patch) | |
tree | a5bdef444b5873a4d24421dcfaf4f94dedbec38c /apps/plugins/lib/gray_parm.c | |
parent | 8cc73f152b510c946a0285ac010639ebd6668ebc (diff) | |
download | rockbox-628d20a6109bf65175e7c4b1bd9477cdccfd7437.tar.gz rockbox-628d20a6109bf65175e7c4b1bd9477cdccfd7437.zip |
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.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/apps/plugins/lib/gray_parm.c b/apps/plugins/lib/gray_parm.c index c6305421c1..a6064e3ad3 100644 --- a/apps/plugins/lib/gray_parm.c +++ b/apps/plugins/lib/gray_parm.c | |||
@@ -61,31 +61,27 @@ int gray_get_drawmode(void) | |||
61 | /* Set the foreground shade for subsequent drawing operations */ | 61 | /* Set the foreground shade for subsequent drawing operations */ |
62 | void gray_set_foreground(unsigned brightness) | 62 | void gray_set_foreground(unsigned brightness) |
63 | { | 63 | { |
64 | unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127; | 64 | _gray_info.fg_brightness = brightness; |
65 | 65 | _gray_info.fg_index = _gray_info.idxtable[brightness]; | |
66 | _gray_info.fg_brightness = (data + (data >> 8)) >> 8; /* approx. data / 255 */ | ||
67 | } | 66 | } |
68 | 67 | ||
69 | /* Return the current foreground shade */ | 68 | /* Return the current foreground shade */ |
70 | unsigned gray_get_foreground(void) | 69 | unsigned gray_get_foreground(void) |
71 | { | 70 | { |
72 | return (_gray_info.fg_brightness * 255 + (_gray_info.depth >> 1)) | 71 | return _gray_info.fg_brightness; |
73 | / _gray_info.depth; | ||
74 | } | 72 | } |
75 | 73 | ||
76 | /* Set the background shade for subsequent drawing operations */ | 74 | /* Set the background shade for subsequent drawing operations */ |
77 | void gray_set_background(unsigned brightness) | 75 | void gray_set_background(unsigned brightness) |
78 | { | 76 | { |
79 | unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127; | 77 | _gray_info.bg_brightness = brightness; |
80 | 78 | _gray_info.bg_index = _gray_info.idxtable[brightness]; | |
81 | _gray_info.bg_brightness = (data + (data >> 8)) >> 8; /* approx. data / 255 */ | ||
82 | } | 79 | } |
83 | 80 | ||
84 | /* Return the current background shade */ | 81 | /* Return the current background shade */ |
85 | unsigned gray_get_background(void) | 82 | unsigned gray_get_background(void) |
86 | { | 83 | { |
87 | return (_gray_info.bg_brightness * 255 + (_gray_info.depth >> 1)) | 84 | return _gray_info.bg_brightness; |
88 | / _gray_info.depth; | ||
89 | } | 85 | } |
90 | 86 | ||
91 | /* Set draw mode, foreground and background shades at once */ | 87 | /* Set draw mode, foreground and background shades at once */ |