From 310a28bea73f76c67aa9c7d2a44029ea4dcdce42 Mon Sep 17 00:00:00 2001 From: Johannes Bildstein Date: Fri, 24 Mar 2017 06:30:36 +0100 Subject: [PATCH] fix incorrect comparison --- .../IccChromaticityTagDataEntry.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs index 1621aa302..235988498 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs @@ -90,7 +90,7 @@ namespace ImageSharp if (base.Equals(other) && other is IccChromaticityTagDataEntry entry) { return this.ColorantType == entry.ColorantType - && this.ChannelValues.SequenceEqual(entry.ChannelValues); + && this.EqualsChannelValues(entry); } return false; @@ -138,5 +138,23 @@ namespace ImageSharp throw new ArgumentException("Unrecognized colorant encoding"); } } + + private bool EqualsChannelValues(IccChromaticityTagDataEntry entry) + { + if (this.ChannelValues.Length != entry.ChannelValues.Length) + { + return false; + } + + for (int i = 0; i < this.ChannelValues.Length; i++) + { + if (!this.ChannelValues[i].SequenceEqual(entry.ChannelValues[i])) + { + return false; + } + } + + return true; + } } }