From 364317b1991cf5daa08ad3ce4e52e735c9789987 Mon Sep 17 00:00:00 2001 From: Ulf Jordan Date: Mon, 18 Aug 2008 19:28:42 +0000 Subject: [PATCH] Fix tinycurses color output on the VGA console. The CGA compatible 16 color VGA text mode expects Intensity RGB color specifications, in the order IRGB from most to least significant bit. Curses COLOR_ macros follows ANSI X3.64/ISO 6429/ECMA-48, specifying RGB color in the order BGR from most to least significant bit. Consequently, it is necessary to swap the red and blue bits. Signed-off-by: Ulf Jordan Acked-by: Jordan Crouse git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3516 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/libpayload/curses/tinycurses.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/payloads/libpayload/curses/tinycurses.c b/payloads/libpayload/curses/tinycurses.c index b3f7bbc50..c901ff66b 100644 --- a/payloads/libpayload/curses/tinycurses.c +++ b/payloads/libpayload/curses/tinycurses.c @@ -658,6 +658,8 @@ int whline(WINDOW *win, chtype ch, int n) return OK; } +#define SWAP_RED_BLUE(c) \ + (((c) & 0x4400) >> 2) | ((c) & 0xAA00) | (((c) & 0x1100) << 2) int wnoutrefresh(WINDOW *win) { // FIXME. @@ -720,6 +722,8 @@ int wnoutrefresh(WINDOW *win) serial_putchar(ch); } + c = SWAP_RED_BLUE(c); + if (curses_flags & F_ENABLE_CONSOLE) { ch = win->_line[y].text[x].chars[0]; -- 2.25.1