1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Fixed hash-calculation

This commit is contained in:
Darth Affe 2017-01-14 23:21:06 +01:00
parent 0db7448f15
commit f7b945cc65

View File

@ -33,7 +33,7 @@ namespace Artemis.Profiles.Layers.Types.AngularBrush.Drawing
{ {
set set
{ {
int hash = value.GetHashCode(); int hash = GetHash(value);
if (_lastGradientHash != hash) if (_lastGradientHash != hash)
{ {
_gradientStops = FixGradientStops(value); _gradientStops = FixGradientStops(value);
@ -176,6 +176,14 @@ namespace Artemis.Profiles.Layers.Types.AngularBrush.Drawing
return stops; return stops;
} }
private static int GetHash(IList<Tuple<double, Color>> sequence)
{
unchecked
{
return sequence.Aggregate(487, (current, item) => (((current * 31) + item.Item1.GetHashCode()) * 31) + item.Item2.GetHashCode());
}
}
#endregion #endregion
} }
} }