changed parantheses and lines
This commit is contained in:
parent
777c7c6c03
commit
4ca947f078
@ -1663,6 +1663,7 @@ Surface::display_colors_on_xtouch(const XTouchColors color_values[]) const
|
||||
uint8_t
|
||||
Surface::convert_color_to_xtouch_value (uint32_t color) const
|
||||
{
|
||||
|
||||
uint8_t red = color >> 24;
|
||||
uint8_t green = (color >> 16) & 0xff;
|
||||
uint8_t blue = (color >> 8) & 0xff;
|
||||
@ -1676,6 +1677,7 @@ Surface::convert_color_to_xtouch_value(uint32_t color) const
|
||||
}
|
||||
|
||||
if (max != 0) {
|
||||
|
||||
//set the highest value to 0xFF to be brightness independent
|
||||
|
||||
float norm = 255.0/max;
|
||||
@ -1685,17 +1687,26 @@ Surface::convert_color_to_xtouch_value(uint32_t color) const
|
||||
|
||||
uint8_t xcolor = 0;
|
||||
if (red > 0x7f) {
|
||||
|
||||
xcolor = xcolor | 0b001; //lowest bit is red
|
||||
|
||||
}
|
||||
if (green > 0x7f) {
|
||||
|
||||
xcolor = xcolor | 0b010; //second bit is green
|
||||
|
||||
}
|
||||
if (blue > 0x7f) {
|
||||
|
||||
xcolor = xcolor | 0b100; //third bit is blue
|
||||
|
||||
}
|
||||
|
||||
return xcolor;
|
||||
}
|
||||
else{
|
||||
|
||||
} else {
|
||||
|
||||
return White; //if it would be black (color = 0x000000) return white, because black means off
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user