sm6250-common: light: simplify alpha scaling logic
Change-Id: I9b5c15d5ec4865d3bf829457d6f110ddb3af6e94
This commit is contained in:
parent
963ec1b29d
commit
3c7ffbcc8b
@ -62,13 +62,11 @@ static uint32_t getBrightness(const LightState& state) {
|
|||||||
blue = state.color & 0xFF;
|
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;
|
||||||
red = red * alpha / 0xFF;
|
green = green * alpha / 0xFF;
|
||||||
green = green * alpha / 0xFF;
|
blue = blue * alpha / 0xFF;
|
||||||
blue = blue * alpha / 0xFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (77 * red + 150 * green + 29 * blue) >> 8;
|
return (77 * red + 150 * green + 29 * blue) >> 8;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user