remove unused code

This commit is contained in:
Jesse Plamondon-Willard
2025-12-26 13:35:53 -05:00
parent 3a5dc95e97
commit 58e59103de
@@ -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;
}
/// <summary>Premultiply a texture's alpha values to avoid transparency issues in the game.</summary>
/// <param name="texture">The texture to premultiply.</param>
/// <returns>Returns a premultiplied texture.</returns>
/// <remarks>Based on <a href="https://gamedev.stackexchange.com/a/26037">code by David Gouveia</a>.</remarks>
private void PremultiplyTransparency(Texture2D texture)
{
int count = texture.Width * texture.Height;
Color[] data = ArrayPool<Color>.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<Color>.Shared.Return(data);
}
}
/// <summary>Fix custom map tilesheet paths so they can be found by the content manager.</summary>
/// <param name="map">The map whose tilesheets to fix.</param>
/// <param name="relativeMapPath">The relative map path within the mod folder.</param>