Merge pull request #8289 from RoosterDragon/fast-case-premultiply

Speed up PremultiplyAlpha
This commit is contained in:
abcdefg30
2015-05-29 23:14:02 +02:00

View File

@@ -114,6 +114,8 @@ namespace OpenRA.Graphics
public static Color PremultiplyAlpha(Color c)
{
if (c.A == byte.MaxValue)
return c;
var a = c.A / 255f;
return Color.FromArgb(c.A, (byte)(c.R * a + 0.5f), (byte)(c.G * a + 0.5f), (byte)(c.B * a + 0.5f));
}