more portable rounding behavior - refs ##1454

This commit is contained in:
Dane Springmeyer 2012-08-31 20:31:06 -07:00
parent d054178a75
commit b8f6b16a56

View file

@ -117,7 +117,7 @@ void image_32::set_grayscale_to_alpha()
unsigned b = (rgba >> 16) & 0xff;
// magic numbers for grayscale
unsigned a = (int)((r * .3) + (g * .59) + (b * .11));
unsigned a = static_cast<unsigned>(std::ceil((r * .3) + (g * .59) + (b * .11)));
row_from[x] = (a << 24)| (255 << 16) | (255 << 8) | (255) ;
}