diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2005-09-09 16:04:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 16:58:00 -0400 |
commit | 2cc38ed13f1b0f9d80a2d0acc2916af94922f27e (patch) | |
tree | a556d3b71c2bca72762255f79f2de17a606382a7 /drivers/video/console/fbcon.c | |
parent | b8c909454f046b59065c6997b651fe20cd90c0f4 (diff) |
[PATCH] fbcon: Saner 16-color to 4-color conversion
Currently, the default linux 16-colors are converted to 4-colors by simply
dividing the values by 4. However, this is not necessarily correct since the
first 4 colors are converted to black, rendering them invisible.
So, for black, no conversion; for light colors, convert to gray, for normal
text color, no conversion, and for bright colors, convert to intense white.
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/console/fbcon.c')
-rw-r--r-- | drivers/video/console/fbcon.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 88bd8ef56fde..bb4ea50b54a3 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -247,9 +247,26 @@ static inline int get_color(struct vc_data *vc, struct fb_info *info, | |||
247 | case 2: | 247 | case 2: |
248 | /* | 248 | /* |
249 | * Scale down 16-colors to 4 colors. Default 4-color palette | 249 | * Scale down 16-colors to 4 colors. Default 4-color palette |
250 | * is grayscale. | 250 | * is grayscale. However, simply dividing the values by 4 |
251 | * will not work, as colors 1, 2 and 3 will be scaled-down | ||
252 | * to zero rendering them invisible. So empirically convert | ||
253 | * colors to a sane 4-level grayscale. | ||
251 | */ | 254 | */ |
252 | color /= 4; | 255 | switch (color) { |
256 | case 0: | ||
257 | color = 0; /* black */ | ||
258 | break; | ||
259 | case 1 ... 6: | ||
260 | color = 2; /* white */ | ||
261 | break; | ||
262 | case 7 ... 8: | ||
263 | color = 1; /* gray */ | ||
264 | break; | ||
265 | default: | ||
266 | color = 3; /* intense white */ | ||
267 | break; | ||
268 | } | ||
269 | break; | ||
253 | case 3: | 270 | case 3: |
254 | /* | 271 | /* |
255 | * Last 8 entries of default 16-color palette is a more intense | 272 | * Last 8 entries of default 16-color palette is a more intense |