diff --git a/osu.Game/Graphics/UserInterface/SegmentedGraph.cs b/osu.Game/Graphics/UserInterface/SegmentedGraph.cs index 8ccba710b8..e0be7c1d0f 100644 --- a/osu.Game/Graphics/UserInterface/SegmentedGraph.cs +++ b/osu.Game/Graphics/UserInterface/SegmentedGraph.cs @@ -7,10 +7,12 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Rendering; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Textures; +using osu.Framework.Utils; using osuTK; namespace osu.Game.Graphics.UserInterface @@ -154,7 +156,19 @@ namespace osu.Game.Graphics.UserInterface segments.Sort(); } - private Colour4 getTierColour(int tier) => tier >= 0 ? tierColours[tier] : new Colour4(0, 0, 0, 0); + private ColourInfo getSegmentColour(SegmentInfo segment) + { + var tierColour = segment.Tier >= 0 ? tierColours[segment.Tier] : new Colour4(0, 0, 0, 0); + var ourColour = DrawColourInfo.Colour; + + return new ColourInfo + { + TopLeft = tierColour * Interpolation.ValueAt(segment.Start, ourColour.TopLeft, ourColour.TopRight, 0, 1), + TopRight = tierColour * Interpolation.ValueAt(segment.End, ourColour.TopLeft, ourColour.TopRight, 0, 1), + BottomLeft = tierColour * Interpolation.ValueAt(segment.Start, ourColour.BottomLeft, ourColour.BottomRight, 0, 1), + BottomRight = tierColour * Interpolation.ValueAt(segment.End, ourColour.BottomLeft, ourColour.BottomRight, 0, 1) + }; + } protected override DrawNode CreateDrawNode() => new SegmentedGraphDrawNode(this); @@ -240,7 +254,7 @@ namespace osu.Game.Graphics.UserInterface Vector2Extensions.Transform(topRight, DrawInfo.Matrix), Vector2Extensions.Transform(bottomLeft, DrawInfo.Matrix), Vector2Extensions.Transform(bottomRight, DrawInfo.Matrix)), - Source.getTierColour(segment.Tier)); + Source.getSegmentColour(segment)); } shader.Unbind();