summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dblbuf.c6
-rw-r--r--term.c7
2 files changed, 6 insertions, 7 deletions
diff --git a/dblbuf.c b/dblbuf.c
index 570731d..2c4fac7 100644
--- a/dblbuf.c
+++ b/dblbuf.c
@@ -89,6 +89,7 @@ void clear_cells(struct uudisp *d, int idx, int x1, int x2)
static unsigned long expand_color(struct uudisp *d, int color)
{
struct dblbuf *b = (void *)&d->priv;
+ static const unsigned char cmap[8] = {0,4,2,6,1,5,3,7};
if (b->bytes_per_pixel > 1) {
int R = color<<1 & 2;
int G = color & 2;
@@ -97,12 +98,13 @@ static unsigned long expand_color(struct uudisp *d, int color)
R++; G++; B++;
}
if (b->bytes_per_pixel == 2)
- return (R*0xa + (G*0x14<<5) + (B*0xa<<11))
+ return (B*0xa + (G*0x14<<5) + (R*0xa<<11))
* (unsigned long)0x0001000100010001;
else if (b->bytes_per_pixel == 4)
- return (R*0x50 + (G*0x50<<8) + (B*0x50<<16))
+ return (B*0x50 + (G*0x50<<8) + (R*0x50<<16))
* (unsigned long)0x0000000100000001;
}
+ color = (color&8) | cmap[color&7];
return color * (unsigned long)0x0101010101010101;
}
diff --git a/term.c b/term.c
index 4f6dda6..d5acd12 100644
--- a/term.c
+++ b/term.c
@@ -190,9 +190,6 @@ static void csi(struct uuterm *t, unsigned c)
break;
case 'm':
for (i=0; i<t->nparam; i++) {
- static const unsigned char cmap[] = {
- 0, 4, 2, 6, 1, 5, 3, 7
- };
static const unsigned short attr[] = {
UU_ATTR_BOLD, UU_ATTR_DIM, 0,
UU_ATTR_UL, UU_ATTR_BLINK, 0,
@@ -208,10 +205,10 @@ static void csi(struct uuterm *t, unsigned c)
t->attr &= ~attr[t->param[i]-21];
} else if (t->param[i]-30 < 8) {
t->attr &= ~UU_ATTR_FG;
- t->attr |= cmap[(t->param[i] - 30)];
+ t->attr |= t->param[i] - 30;
} else if (t->param[i]-40 < 8) {
t->attr &= ~UU_ATTR_BG;
- t->attr |= cmap[(t->param[i] - 40)] << 4;
+ t->attr |= t->param[i] - 40 << 4;
}
}
break;