From b84994e64398dc174d020c7bb2d08d2915823311 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Sep 2018 15:29:22 +0900 Subject: [PATCH] Make GetTexture return the post-scaled texture --- osu.Game/Skinning/LegacySkin.cs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index ce7edf8683..58b1117598 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -58,25 +58,29 @@ namespace osu.Game.Skinning break; } - float ratio = 0.72f; // brings sizing roughly in-line with stable - - var texture = GetTexture($"{componentName}@2x"); - if (texture == null) - { - ratio *= 2; - texture = GetTexture(componentName); - } + var texture = GetTexture(componentName); if (texture == null) return null; - return new Sprite - { - Texture = texture, - Scale = new Vector2(ratio), - }; + return new Sprite { Texture = texture }; } - public override Texture GetTexture(string componentName) => Textures.Get(componentName); + public override Texture GetTexture(string componentName) + { + float ratio = 2; + + var texture = Textures.Get($"{componentName}@2x"); + if (texture == null) + { + ratio = 1; + texture = Textures.Get(componentName); + } + + if (texture != null) + texture.ScaleAdjust = ratio / 0.72f; // brings sizing roughly in-line with stable + + return texture; + } public override SampleChannel GetSample(string sampleName) => Samples.Get(sampleName);