1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 11:12:59 +08:00

Remove secondary buffered container from slider body

This commit is contained in:
smoogipoo 2019-06-06 16:32:43 +09:00
parent 85ea650643
commit ae438213a5

View File

@ -2,13 +2,10 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Lines; using osu.Framework.Graphics.Lines;
using osu.Framework.Graphics.Primitives;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using osuTK.Graphics.ES30;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
@ -19,8 +16,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private readonly SliderPath path; private readonly SliderPath path;
protected Path Path => path; protected Path Path => path;
private readonly BufferedContainer container;
public float PathRadius public float PathRadius
{ {
get => path.PathRadius; get => path.PathRadius;
@ -44,8 +39,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
return; return;
path.AccentColour = value; path.AccentColour = value;
container.ForceRedraw();
} }
} }
@ -61,8 +54,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
return; return;
path.BorderColour = value; path.BorderColour = value;
container.ForceRedraw();
} }
} }
@ -78,23 +69,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
return; return;
path.BorderSize = value; path.BorderSize = value;
container.ForceRedraw();
} }
} }
public Quad PathDrawQuad => container.ScreenSpaceDrawQuad;
protected SliderBody() protected SliderBody()
{ {
InternalChild = container = new BufferedContainer InternalChild = path = new SliderPath();
{
RelativeSizeAxes = Axes.Both,
CacheDrawnFrameBuffer = true,
Child = path = new SliderPath { Blending = BlendingMode.None }
};
container.Attach(RenderbufferInternalFormat.DepthComponent16);
} }
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos);
@ -103,11 +83,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
/// Sets the vertices of the path which should be drawn by this <see cref="SliderBody"/>. /// Sets the vertices of the path which should be drawn by this <see cref="SliderBody"/>.
/// </summary> /// </summary>
/// <param name="vertices">The vertices</param> /// <param name="vertices">The vertices</param>
protected void SetVertices(IReadOnlyList<Vector2> vertices) protected void SetVertices(IReadOnlyList<Vector2> vertices) => path.Vertices = vertices;
{
path.Vertices = vertices;
container.ForceRedraw();
}
private class SliderPath : SmoothPath private class SliderPath : SmoothPath
{ {