diff options
author | Jiri Slaby <jslaby@suse.cz> | 2016-06-23 07:34:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-06-25 12:04:48 -0400 |
commit | 193df0227964a0620267bb0236dfd6463a0ccea0 (patch) | |
tree | 3df5129bd6ba6e863d714e860c1151ffc9366ed2 /drivers/tty/vt | |
parent | 0f91e14264cb04c90987206f30d97385eef121c9 (diff) |
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: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r-- | drivers/tty/vt/vt.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 63972336de20..acecd6662426 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -1260,18 +1260,23 @@ static void rgb_from_256(int i, struct rgb *c) | |||
1260 | 1260 | ||
1261 | static void rgb_foreground(struct vc_data *vc, const struct rgb *c) | 1261 | static void rgb_foreground(struct vc_data *vc, const struct rgb *c) |
1262 | { | 1262 | { |
1263 | u8 hue, max = c->r; | 1263 | u8 hue = 0, max = max3(c->r, c->g, c->b); |
1264 | if (c->g > max) | 1264 | |
1265 | max = c->g; | 1265 | if (c->r > max / 2) |
1266 | if (c->b > max) | 1266 | hue |= 4; |
1267 | max = c->b; | 1267 | if (c->g > max / 2) |
1268 | hue = (c->r > max/2 ? 4 : 0) | 1268 | hue |= 2; |
1269 | | (c->g > max/2 ? 2 : 0) | 1269 | if (c->b > max / 2) |
1270 | | (c->b > max/2 ? 1 : 0); | 1270 | hue |= 1; |
1271 | if (hue == 7 && max <= 0x55) | 1271 | |
1272 | hue = 0, vc->vc_intensity = 2; | 1272 | if (hue == 7 && max <= 0x55) { |
1273 | hue = 0; | ||
1274 | vc->vc_intensity = 2; | ||
1275 | } else if (max > 0xaa) | ||
1276 | vc->vc_intensity = 2; | ||
1273 | else | 1277 | else |
1274 | vc->vc_intensity = (max > 0xaa) + 1; | 1278 | vc->vc_intensity = 1; |
1279 | |||
1275 | vc->vc_color = (vc->vc_color & 0xf0) | hue; | 1280 | vc->vc_color = (vc->vc_color & 0xf0) | hue; |
1276 | } | 1281 | } |
1277 | 1282 | ||