GUACAMOLE-188: Clamp alpha blending results to maximum component value (0xFF).
This commit is contained in:
parent
12d29569a6
commit
0fb567bb53
@ -880,7 +880,15 @@ static void __guac_common_surface_set(guac_common_surface* dst,
|
|||||||
* given source and destination components.
|
* given source and destination components.
|
||||||
*/
|
*/
|
||||||
static int guac_common_surface_blend_component(int dst, int src, int alpha) {
|
static int guac_common_surface_blend_component(int dst, int src, int alpha) {
|
||||||
return src + dst * (0xFF - alpha);
|
|
||||||
|
int blended = src + dst * (0xFF - alpha);
|
||||||
|
|
||||||
|
/* Do not exceed maximum component value */
|
||||||
|
if (blended > 0xFF)
|
||||||
|
return 0xFF;
|
||||||
|
|
||||||
|
return blended;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user