Skip to content

Commit

Permalink
Remove HasFlagFast() extension, restore Enum.HasFlag()
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jul 8, 2024
1 parent 499035a commit 9ec070a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
3 changes: 1 addition & 2 deletions osu.Framework.Font/Graphics/Containers/MaskingContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Rendering;

Expand Down Expand Up @@ -75,7 +74,7 @@ private static RectangleI generateMasking(RectangleI source, Edges edges)
int getExtendSize(Edges flag)
{
const int extend_size = 1000;
return edges.HasFlagFast(flag) ? 0 : extend_size;
return edges.HasFlag(flag) ? 0 : extend_size;
}
}

Expand Down
13 changes: 6 additions & 7 deletions osu.Framework.Font/Graphics/Extensions/RectangleFExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) karaoke.dev <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics.Primitives;
using osuTK;

Expand All @@ -24,27 +23,27 @@ public static RectangleF Scale(this RectangleF source, Vector2 scale, Anchor ori

static float getXScale(Anchor origin)
{
if (origin.HasFlagFast(Anchor.x0))
if (origin.HasFlag(Anchor.x0))
return 0;

if (origin.HasFlagFast(Anchor.x1))
if (origin.HasFlag(Anchor.x1))
return 0.5f;

if (origin.HasFlagFast(Anchor.x2))
if (origin.HasFlag(Anchor.x2))
return 1f;

return 100;
}

static float getYScale(Anchor origin)
{
if (origin.HasFlagFast(Anchor.y0))
if (origin.HasFlag(Anchor.y0))
return 0;

if (origin.HasFlagFast(Anchor.y1))
if (origin.HasFlag(Anchor.y1))
return 0.5f;

if (origin.HasFlagFast(Anchor.y2))
if (origin.HasFlag(Anchor.y2))
return 1f;

return 100;
Expand Down
3 changes: 1 addition & 2 deletions osu.Framework.Font/Graphics/Sprites/KaraokeSpriteText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shaders;
Expand Down Expand Up @@ -412,7 +411,7 @@ protected override bool OnInvalidate(Invalidation invalidation, InvalidationSour
{
var result = base.OnInvalidate(invalidation, source);

if (!invalidation.HasFlagFast(Invalidation.Layout))
if (!invalidation.HasFlag(Invalidation.Layout))
return result;

Schedule(RefreshStateTransforms);
Expand Down

0 comments on commit 9ec070a

Please sign in to comment.