Fix an off-by-one in the pure int alpha_blend

This commit is contained in:
Kevin Lange 2012-04-17 18:36:29 -05:00
parent 1ea3fc5652
commit 1869a37582

View File

@ -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);
}