mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 08:12:56 +08:00
Reduce excessive Color4
allocations during path colour updates
This commit is contained in:
parent
c2706ca91b
commit
5d6f767dbd
@ -328,14 +328,17 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private partial class BackgroundPath : SmoothPath
|
private partial class BackgroundPath : SmoothPath
|
||||||
{
|
{
|
||||||
|
private static readonly Color4 colour_white = Color4.White.Opacity(0.8f);
|
||||||
|
private static readonly Color4 colour_black = Color4.Black.Opacity(0.2f);
|
||||||
|
|
||||||
protected override Color4 ColourAt(float position)
|
protected override Color4 ColourAt(float position)
|
||||||
{
|
{
|
||||||
if (position <= 0.16f)
|
if (position <= 0.16f)
|
||||||
return Color4.White.Opacity(0.8f);
|
return colour_white;
|
||||||
|
|
||||||
return Interpolation.ValueAt(position,
|
return Interpolation.ValueAt(position,
|
||||||
Color4.White.Opacity(0.8f),
|
colour_white,
|
||||||
Color4.Black.Opacity(0.2f),
|
colour_black,
|
||||||
-0.5f, 1f, Easing.OutQuint);
|
-0.5f, 1f, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,12 +377,14 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
public float GlowPortion { get; init; }
|
public float GlowPortion { get; init; }
|
||||||
|
|
||||||
|
private static readonly Colour4 transparent_black = Colour4.Black.Opacity(0.0f);
|
||||||
|
|
||||||
protected override Color4 ColourAt(float position)
|
protected override Color4 ColourAt(float position)
|
||||||
{
|
{
|
||||||
if (position >= GlowPortion)
|
if (position >= GlowPortion)
|
||||||
return BarColour;
|
return BarColour;
|
||||||
|
|
||||||
return Interpolation.ValueAt(position, Colour4.Black.Opacity(0.0f), GlowColour, 0.0, GlowPortion, Easing.InQuint);
|
return Interpolation.ValueAt(position, transparent_black, GlowColour, 0.0, GlowPortion, Easing.InQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user