diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs index 52287445..503fd984 100644 --- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs @@ -1,5 +1,4 @@ using System; -using System.Buffers; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; @@ -355,38 +354,6 @@ internal sealed class ModContentManager : BaseContentManager return file; } - /// Premultiply a texture's alpha values to avoid transparency issues in the game. - /// The texture to premultiply. - /// Returns a premultiplied texture. - /// Based on code by David Gouveia. - private void PremultiplyTransparency(Texture2D texture) - { - int count = texture.Width * texture.Height; - Color[] data = ArrayPool.Shared.Rent(count); - try - { - texture.GetData(data, 0, count); - - bool changed = false; - for (int i = 0; i < count; i++) - { - ref Color pixel = ref data[i]; - if (pixel.A is (byte.MinValue or byte.MaxValue)) - continue; // no need to change fully transparent/opaque pixels - - data[i] = new Color(pixel.R * pixel.A / byte.MaxValue, pixel.G * pixel.A / byte.MaxValue, pixel.B * pixel.A / byte.MaxValue, pixel.A); // slower version: Color.FromNonPremultiplied(data[i].ToVector4()) - changed = true; - } - - if (changed) - texture.SetData(data, 0, count); - } - finally - { - ArrayPool.Shared.Return(data); - } - } - /// Fix custom map tilesheet paths so they can be found by the content manager. /// The map whose tilesheets to fix. /// The relative map path within the mod folder.