sm6250-common: light: simplify alpha scaling logic

Change-Id: I9b5c15d5ec4865d3bf829457d6f110ddb3af6e94
This commit is contained in:
Demon000 2020-02-15 11:16:27 +00:00
parent 963ec1b29d
commit 3c7ffbcc8b

View File

@ -62,13 +62,11 @@ static uint32_t getBrightness(const LightState& state) {
blue = state.color & 0xFF;
/*
* Scale RGB brightness if Alpha brightness is not 0xFF.
* Scale RGB brightness using Alpha brightness.
*/
if (alpha != 0xFF) {
red = red * alpha / 0xFF;
green = green * alpha / 0xFF;
blue = blue * alpha / 0xFF;
}
red = red * alpha / 0xFF;
green = green * alpha / 0xFF;
blue = blue * alpha / 0xFF;
return (77 * red + 150 * green + 29 * blue) >> 8;
}