fix semi-transparency issues on Linux/Mac

Apparently Mono no longer premultiplies loaded PNGs by default.
This commit is contained in:
Jesse Plamondon-Willard 2020-03-14 18:47:19 -04:00
parent e80b7712f7
commit dfb1235133
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 1 additions and 7 deletions

View File

@ -3,6 +3,7 @@
# Release notes
## Upcoming release
* For players:
* Fixed semi-transparency issues on Linux/Mac in recent versions of Mono (e.g. pink shadows).
* Updated translations. Thanks to Annosz (added Hungarian)!
* For modders:

View File

@ -241,13 +241,6 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <remarks>Based on <a href="https://gamedev.stackexchange.com/a/26037">code by David Gouveia</a>.</remarks>
private Texture2D PremultiplyTransparency(Texture2D texture)
{
// Textures loaded by Texture2D.FromStream are already premultiplied on Linux/Mac, even
// though the XNA documentation explicitly says otherwise. That's a glitch in MonoGame
// fixed in newer versions, but the game uses a bundled version that will always be
// affected. See https://github.com/MonoGame/MonoGame/issues/4820 for more info.
if (Constants.TargetPlatform != GamePlatform.Windows)
return texture;
// premultiply pixels
Color[] data = new Color[texture.Width * texture.Height];
texture.GetData(data);