summaryrefslogtreecommitdiff
path: root/dblbuf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2006-10-12 09:08:39 +0000
committerRich Felker <dalias@aerifal.cx>2006-10-12 09:08:39 +0000
commitb1810d2fc0312c36b65bf26cc411473ef3e91db9 (patch)
tree6cb0f3597dc8fd5860c5b0fb697ed770f59ddeb1 /dblbuf.c
parent65d1709c918dc981e389d63059954dc5664c8d33 (diff)
remove nasty hack for backwards colors in default pc/linux palette
(actually it's just moved to dblbuf.c for now, but this makes it easier to remove in the future when proper color palette config is implemented.)
Diffstat (limited to 'dblbuf.c')
-rw-r--r--dblbuf.c6
1 files changed, 4 insertions, 2 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;
}