Oops, my fix for bright colors broke bright black some more (in cases

that used to work via the bold hack).

Fix the table entry for bright black.  Fix spelling of plain black in
nearby table entries (use the macro for black everywhere everywhere).
Fix the currently-unused non-bright color table to not have bright
colors in entries 9-15.

Improve nearby comments.  Start converting to the xterm terminology
and default rendering of "bright" instead of "light" for bright
colors.

Syscons wasn't affected by the bug since I optimized it a little by
converting colors 0-15 directly.  This also fixes the layering of
the conversion for these colors.

Apply the same optimization to vt (actually the layer above it).  This
also moves the conversion 1 closer to the correct layer for colors
0-15.

The optimization of just avoiding 2 calls to a trivial function is worth
about 10% for simple output to the virtual buffer with occasional
rendering.  The optimization is so large because the 2 calls are done
on every character, so although there are too many other calls and
other instructions per character, there are only about 10 times as
many.  Old versions of syscons were about 10 times faster for simple
output, by using a fast path with about 12 instructions per character.
Rendering to even slow hardware takes relatively little time provided
it is rarely actually done.
This commit is contained in:
bde 2017-03-27 10:48:28 +00:00
parent 1eefe93a8f
commit 4c8fc1ac5e
2 changed files with 19 additions and 10 deletions

View File

@ -146,9 +146,18 @@ static const teken_attr_t default_message = {
TCOLOR_BG(_c & 7) | ((_c & 8) << 20); \
})
#define TCOLOR_256TO16(color) __extension__ ({ \
teken_color_t _c; \
\
_c = (color); \
if (_c >= 16) \
_c = teken_256to16(_c); \
_c; \
})
#define TCHAR_CREATE(c, a) ((c) | TFORMAT((a)->ta_format) | \
TCOLOR_FG_FUDGED(teken_256to16((a)->ta_fgcolor)) | \
TCOLOR_BG_FUDGED(teken_256to16((a)->ta_bgcolor)))
TCOLOR_FG_FUDGED(TCOLOR_256TO16((a)->ta_fgcolor)) | \
TCOLOR_BG_FUDGED(TCOLOR_256TO16((a)->ta_bgcolor)))
static void
terminal_init(struct terminal *tm)

View File

@ -491,11 +491,11 @@ teken_state_numbers(teken_t *t, teken_char_t c)
* be twice as large as green in (0, 1, 2).
*/
static const teken_color_t teken_256to8tab[] = {
/* xterm-16+ 8 dark colors: */
0, r, g, y, b, m, c, w,
/* xterm normal colors: */
k, r, g, y, b, m, c, w,
/* xterm-16+ 8 light colors: */
0, R, G, Y, B, M, C, W,
/* xterm bright colors: */
k, r, g, y, b, m, c, w,
/* Red0 submap. */
k, b, b, b, b, b,
@ -559,11 +559,11 @@ static const teken_color_t teken_256to8tab[] = {
* used for different fine tuning of the tables.
*/
static const teken_color_t teken_256to16tab[] = {
/* xterm-16+ 8 dark colors: */
0, r, g, y, b, m, c, w,
/* xterm normal colors: */
k, r, g, y, b, m, c, w,
/* xterm-16+ 8 light colors: */
0, R, G, Y, B, M, C, W,
/* xterm bright colors: */
K, R, G, Y, B, M, C, W,
/* Red0 submap. */
k, b, b, b, b, b,