summaryrefslogtreecommitdiff
path: root/usr/src/common
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-10-04 23:42:15 +0300
committerToomas Soome <tsoome@me.com>2020-10-27 17:33:59 +0200
commit91061836e6d66992af6a50374729f8ef6a6263ae (patch)
treebdfa50dd2c0818095b3cd2ab60ca1cbcf5611660 /usr/src/common
parentd7c4a96fc8acd91d67ffddf9f159987336b28efc (diff)
downloadillumos-joyent-91061836e6d66992af6a50374729f8ef6a6263ae.tar.gz
13204 loader: 8-bit depth can draw 256 colors
Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/common')
-rw-r--r--usr/src/common/font/font.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr/src/common/font/font.c b/usr/src/common/font/font.c
index f46c34a988..81d5b4ae53 100644
--- a/usr/src/common/font/font.c
+++ b/usr/src/common/font/font.c
@@ -88,22 +88,22 @@ const text_cmap_t cmap4_to_24 = {
/* END CSTYLED */
static uint32_t
-rgb_to_color(const rgb_t *rgb, uint8_t r, uint8_t g, uint8_t b)
+rgb_to_color(const rgb_t *rgb, uint32_t r, uint32_t g, uint32_t b)
{
uint32_t color;
int pos, size;
pos = rgb->red.pos;
size = rgb->red.size;
- color = ((r >> (8 - size)) & ((1 << size) - 1)) << pos;
+ color = ((r * ((1 << size) - 1)) / 0xff) << pos;
pos = rgb->green.pos;
size = rgb->green.size;
- color |= ((g >> (8 - size)) & ((1 << size) - 1)) << pos;
+ color |= (((g * ((1 << size) - 1)) / 0xff) << pos);
pos = rgb->blue.pos;
size = rgb->blue.size;
- color |= ((b >> (8 - size)) & ((1 << size) - 1)) << pos;
+ color |= (((b * ((1 << size) - 1)) / 0xff) << pos);
return (color);
}