Fix an off-by-one in the pure int alpha_blend
This commit is contained in:
parent
1ea3fc5652
commit
1869a37582
@ -68,9 +68,9 @@ uint32_t rgb(uint8_t r, uint8_t g, uint8_t b) {
|
||||
|
||||
uint32_t alpha_blend(uint32_t bottom, uint32_t top, uint32_t mask) {
|
||||
uint8_t a = _RED(mask);
|
||||
uint8_t red = (_RED(bottom) * (255 - a) + _RED(top) * a) / 256;
|
||||
uint8_t gre = (_GRE(bottom) * (255 - a) + _GRE(top) * a) / 256;
|
||||
uint8_t blu = (_BLU(bottom) * (255 - a) + _BLU(top) * a) / 256;
|
||||
uint8_t red = (_RED(bottom) * (256 - a) + _RED(top) * a) / 256;
|
||||
uint8_t gre = (_GRE(bottom) * (256 - a) + _GRE(top) * a) / 256;
|
||||
uint8_t blu = (_BLU(bottom) * (256 - a) + _BLU(top) * a) / 256;
|
||||
return rgb(red,gre,blu);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user