Commit 193df022 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

tty: vt, too many commands per line in rgb_foreground

Do not opencode max3, use the macro.

Separate commands. Until now, I have not noticed the comma. Make it
one line, one command. And make the code obvious.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0f91e142
...@@ -1260,18 +1260,23 @@ static void rgb_from_256(int i, struct rgb *c) ...@@ -1260,18 +1260,23 @@ static void rgb_from_256(int i, struct rgb *c)
static void rgb_foreground(struct vc_data *vc, const struct rgb *c) static void rgb_foreground(struct vc_data *vc, const struct rgb *c)
{ {
u8 hue, max = c->r; u8 hue = 0, max = max3(c->r, c->g, c->b);
if (c->g > max)
max = c->g; if (c->r > max / 2)
if (c->b > max) hue |= 4;
max = c->b; if (c->g > max / 2)
hue = (c->r > max/2 ? 4 : 0) hue |= 2;
| (c->g > max/2 ? 2 : 0) if (c->b > max / 2)
| (c->b > max/2 ? 1 : 0); hue |= 1;
if (hue == 7 && max <= 0x55)
hue = 0, vc->vc_intensity = 2; if (hue == 7 && max <= 0x55) {
hue = 0;
vc->vc_intensity = 2;
} else if (max > 0xaa)
vc->vc_intensity = 2;
else else
vc->vc_intensity = (max > 0xaa) + 1; vc->vc_intensity = 1;
vc->vc_color = (vc->vc_color & 0xf0) | hue; vc->vc_color = (vc->vc_color & 0xf0) | hue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment