mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 01:33:21 +08:00
f149a66a4d
Until now, many online textures were retrieved via the default texture store, which causes them to never be removed from GPU memory. It also has a performance overhead due to mipmap generation (which will be avoided via ppy/osu-framework#1885.
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Sprites;
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
|
{
|
|
public class MedalIcon : Container
|
|
{
|
|
private readonly string slug;
|
|
private readonly Sprite sprite;
|
|
|
|
private string url => $@"https://s.ppy.sh/images/medals-client/{slug}@2x.png";
|
|
|
|
public MedalIcon(string slug)
|
|
{
|
|
this.slug = slug;
|
|
|
|
Child = sprite = new Sprite
|
|
{
|
|
Height = 40,
|
|
Width = 40,
|
|
Anchor = Anchor.Centre,
|
|
Origin = Anchor.Centre,
|
|
};
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(LargeTextureStore textures)
|
|
{
|
|
sprite.Texture = textures.Get(url);
|
|
}
|
|
}
|
|
}
|