1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00
osu-lazer/osu.Game/Users/UserCoverBackground.cs
Dean Herbert f149a66a4d Use LargeTextureStore for all online texture retrieval
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.
2018-09-09 02:45:37 +09:00

31 lines
821 B
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 System;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Users
{
public class UserCoverBackground : Sprite
{
private readonly User user;
public UserCoverBackground(User user)
{
this.user = user;
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
{
if (textures == null)
throw new ArgumentNullException(nameof(textures));
if (!string.IsNullOrEmpty(user.CoverUrl))
Texture = textures.Get(user.CoverUrl);
}
}
}