summaryrefslogtreecommitdiffstats
path: root/drivers/video/console
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2005-09-09 22:04:38 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 22:58:00 +0200
commit2cc38ed13f1b0f9d80a2d0acc2916af94922f27e (patch)
treea556d3b71c2bca72762255f79f2de17a606382a7 /drivers/video/console
parent[PATCH] fbdev: Fix greater than 1 bit monochrome color handling (diff)
downloadlinux-2cc38ed13f1b0f9d80a2d0acc2916af94922f27e.tar.xz
linux-2cc38ed13f1b0f9d80a2d0acc2916af94922f27e.zip
[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')
-rw-r--r--drivers/video/console/fbcon.c21
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,
case 2:
/*
* Scale down 16-colors to 4 colors. Default 4-color palette
- * is grayscale.
+ * is grayscale. However, simply dividing the values by 4
+ * will not work, as colors 1, 2 and 3 will be scaled-down
+ * to zero rendering them invisible. So empirically convert
+ * colors to a sane 4-level grayscale.
*/
- color /= 4;
+ switch (color) {
+ case 0:
+ color = 0; /* black */
+ break;
+ case 1 ... 6:
+ color = 2; /* white */
+ break;
+ case 7 ... 8:
+ color = 1; /* gray */
+ break;
+ default:
+ color = 3; /* intense white */
+ break;
+ }
+ break;
case 3:
/*
* Last 8 entries of default 16-color palette is a more intense