summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/gray_parm.c
diff options
context:
space:
mode:
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 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 */
62void gray_set_foreground(unsigned brightness) 62void 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 */
70unsigned gray_get_foreground(void) 69unsigned 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 */
77void gray_set_background(unsigned brightness) 75void 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 */
85unsigned gray_get_background(void) 82unsigned 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 */