Browse Source

implemented Equals and GetHashCode in FontKey for skia typeface cache.

pull/680/head
danwalmsley 10 years ago
parent
commit
fbfa7fe997
  1. 22
      src/Skia/Avalonia.Skia/TypefaceCache.cs

22
src/Skia/Avalonia.Skia/TypefaceCache.cs

@ -20,7 +20,27 @@ namespace Avalonia.Skia
Slant = slant; Slant = slant;
Weight = weight; Weight = weight;
} }
public override int GetHashCode()
{
int hash = 17;
hash = hash * 31 + (int)Slant;
hash = hash * 31 + (int)Weight;
return hash;
}
public override bool Equals(object other)
{
return other is FontKey ? Equals((FontKey)other) : false;
}
public bool Equals(FontKey other)
{
return Slant == other.Slant &&
Weight == other.Weight;
}
// Equals and GetHashCode ommitted // Equals and GetHashCode ommitted
} }

Loading…
Cancel
Save