mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 19:22:56 +08:00
Fix Background blur thread-safety (#5362)
Fix Background blur thread-safety
This commit is contained in:
commit
338f757c81
@ -16,7 +16,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
/// </summary>
|
||||
public class Background : CompositeDrawable
|
||||
{
|
||||
public Sprite Sprite;
|
||||
public readonly Sprite Sprite;
|
||||
|
||||
private readonly string textureName;
|
||||
|
||||
@ -51,7 +51,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
|
||||
public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None)
|
||||
{
|
||||
if (bufferedContainer == null)
|
||||
if (bufferedContainer == null && newBlurSigma != Vector2.Zero)
|
||||
{
|
||||
RemoveInternal(Sprite);
|
||||
|
||||
@ -63,7 +63,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
});
|
||||
}
|
||||
|
||||
bufferedContainer.BlurTo(newBlurSigma, duration, easing);
|
||||
bufferedContainer?.BlurTo(newBlurSigma, duration, easing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
@ -168,6 +168,12 @@ namespace osu.Game.Screens.Backgrounds
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
userBlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
userBlurLevel.ValueChanged += _ => UpdateVisuals();
|
||||
BlurAmount.ValueChanged += _ => UpdateVisuals();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user