Skip to content

Commit 3206542

Browse files
Add IEquatable to GlyphColor
1 parent ec731ad commit 3206542

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/SixLabors.Fonts/GlyphColor.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace SixLabors.Fonts;
99
/// <summary>
1010
/// Provides access to the color details for the current glyph.
1111
/// </summary>
12-
public readonly partial struct GlyphColor
12+
public readonly partial struct GlyphColor : IEquatable<GlyphColor>
1313
{
1414
internal GlyphColor(byte red, byte green, byte blue, byte alpha)
1515
{
@@ -70,7 +70,8 @@ internal GlyphColor(byte red, byte green, byte blue, byte alpha)
7070
=> !left.Equals(right);
7171

7272
/// <inheritdoc/>
73-
public override bool Equals(object? obj) => obj is GlyphColor p && this.Equals(p);
73+
public override bool Equals(object? obj)
74+
=> obj is GlyphColor p && this.Equals(p);
7475

7576
/// <summary>
7677
/// Compares the <see cref="GlyphColor"/> for equality to this color.
@@ -122,10 +123,8 @@ public static bool TryParseHex(string? value, [NotNullWhen(true)] out GlyphColor
122123
{
123124
return false;
124125
}
125-
else
126-
{
127-
hex = hex[1..];
128-
}
126+
127+
hex = hex[1..];
129128

130129
byte a = 255, r, g, b;
131130

@@ -200,12 +199,7 @@ public static bool TryParseNamed(string? name, [NotNullWhen(true)] out GlyphColo
200199
return false;
201200
}
202201

203-
if (NamedGlyphColorsLookupLazy.Value.TryGetValue(name, out result))
204-
{
205-
return true;
206-
}
207-
208-
return false;
202+
return NamedGlyphColorsLookupLazy.Value.TryGetValue(name, out result);
209203
}
210204

211205
[MethodImpl(MethodImplOptions.AggressiveInlining)]

0 commit comments

Comments
 (0)