diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerMaxDimensions.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerMaxDimensions.cs index 68443b234b..741fc7d789 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePlayerMaxDimensions.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePlayerMaxDimensions.cs @@ -72,66 +72,18 @@ namespace osu.Game.Tests.Visual.Gameplay remove { } } + public override Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) + { + var texture = base.GetTexture(componentName, wrapModeS, wrapModeT); + + if (texture != null) + texture.ScaleAdjust /= scale_factor; + + return texture; + } + public ISkin FindProvider(Func lookupFunction) => this; public IEnumerable AllSources => new[] { this }; - - protected override IResourceStore CreateTextureLoaderStore(IStorageResourceProvider resources, IResourceStore storage) - => new UpscaledTextureLoaderStore(base.CreateTextureLoaderStore(resources, storage)); - - private class UpscaledTextureLoaderStore : IResourceStore - { - private readonly IResourceStore? textureStore; - - public UpscaledTextureLoaderStore(IResourceStore? textureStore) - { - this.textureStore = textureStore; - } - - public void Dispose() - { - textureStore?.Dispose(); - } - - public TextureUpload Get(string name) - { - var textureUpload = textureStore?.Get(name); - - // NRT not enabled on framework side classes (IResourceStore / TextureLoaderStore), welp. - if (textureUpload == null) - return null!; - - return upscale(textureUpload); - } - - public async Task GetAsync(string name, CancellationToken cancellationToken = new CancellationToken()) - { - // NRT not enabled on framework side classes (IResourceStore / TextureLoaderStore), welp. - if (textureStore == null) - return null!; - - var textureUpload = await textureStore.GetAsync(name, cancellationToken).ConfigureAwait(false); - - if (textureUpload == null) - return null!; - - return await Task.Run(() => upscale(textureUpload), cancellationToken).ConfigureAwait(false); - } - - private TextureUpload upscale(TextureUpload textureUpload) - { - var image = Image.LoadPixelData(textureUpload.Data.ToArray(), textureUpload.Width, textureUpload.Height); - - // The original texture upload will no longer be returned or used. - textureUpload.Dispose(); - - image.Mutate(i => i.Resize(new Size(textureUpload.Width, textureUpload.Height) * scale_factor)); - return new TextureUpload(image); - } - - public Stream? GetStream(string name) => textureStore?.GetStream(name); - - public IEnumerable GetAvailableResources() => textureStore?.GetAvailableResources() ?? Array.Empty(); - } } } }