From 0a186fe7229380551c663cb828f299bb6634a5b3 Mon Sep 17 00:00:00 2001 From: recapitalverb <41869184+recapitalverb@users.noreply.github.com> Date: Sun, 2 Feb 2020 22:37:58 +0700 Subject: [PATCH] Avoid calculating constants in load() --- .../Profile/Sections/Ranks/DrawableProfileScore.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index 930f9b8a43..1905728442 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -25,6 +25,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks private const int performance_width = 80; private const float performance_background_shear = 0.45f; + private float performance_background_width = performance_width + (height / 4f * MathF.Tan(performance_background_shear)); protected readonly ScoreInfo Score; @@ -45,8 +46,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks [BackgroundDependencyLoader] private void load() { - float performanceBackgroundWidth = performance_width + (height / 4f * MathF.Tan(performance_background_shear)); - AddInternal(new ProfileItemContainer { Children = new Drawable[] @@ -148,7 +147,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Y, - Width = performanceBackgroundWidth, + Width = performance_background_width, Height = 0.5f, Colour = colourProvider.Background4, Shear = new Vector2(-performance_background_shear, 0), @@ -160,7 +159,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Y, RelativePositionAxes = Axes.Y, - Width = performanceBackgroundWidth, + Width = performance_background_width, Height = -0.5f, Position = new Vector2(0, 1), Colour = colourProvider.Background4,