Browse Source

Spanify blittable equality checks

af/merge-core
Jason Nelson 8 years ago
parent
commit
02496102cd
  1. 2
      src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
  2. 2
      src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
  3. 3
      src/ImageSharp/MetaData/Profiles/ICC/Curves/IccSampledCurveElement.cs
  4. 3
      src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccMatrixProcessElement.cs
  5. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs
  6. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
  7. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs
  8. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs
  9. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs
  10. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs
  11. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs
  12. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs
  13. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
  14. 2
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
  15. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs
  16. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs
  17. 3
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs
  18. 7
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccXyzTagDataEntry.cs
  19. 4
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
  20. 3
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccLut.cs
  21. 2
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs

2
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs

@ -51,7 +51,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return this.BreakPoints.SequenceEqual(other.BreakPoints)
return this.BreakPoints.AsSpan().SequenceEqual(other.BreakPoints)
&& this.Segments.SequenceEqual(other.Segments);
}
}

2
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs

@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
return this.CurveType == other.CurveType
&& this.XyzValues.SequenceEqual(other.XyzValues)
&& this.XyzValues.AsSpan().SequenceEqual(other.XyzValues)
&& this.EqualsResponseArray(other);
}

3
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccSampledCurveElement.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -34,7 +33,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
if (base.Equals(other) && other is IccSampledCurveElement segment)
{
return this.CurveEntries.SequenceEqual(segment.CurveEntries);
return this.CurveEntries.AsSpan().SequenceEqual(segment.CurveEntries);
}
return false;

3
src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccMatrixProcessElement.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
using SixLabors.ImageSharp.Primitives;
@ -47,7 +46,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
if (base.Equals(other) && other is IccMatrixProcessElement element)
{
return this.EqualsMatrix(element)
&& this.MatrixOx1.SequenceEqual(element.MatrixOx1);
&& this.MatrixOx1.AsSpan().SequenceEqual(element.MatrixOx1);
}
return false;

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -59,7 +58,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.ColorantNumber.SequenceEqual(other.ColorantNumber);
return base.Equals(other) && this.ColorantNumber.AsSpan().SequenceEqual(other.ColorantNumber);
}
/// <inheritdoc/>

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -107,7 +106,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.CurveData.SequenceEqual(other.CurveData);
return base.Equals(other) && this.CurveData.AsSpan().SequenceEqual(other.CurveData);
}
/// <inheritdoc/>

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
using System.Text;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
@ -83,7 +82,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data) && this.IsAscii == other.IsAscii;
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data) && this.IsAscii == other.IsAscii;
}
/// <inheritdoc/>

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -56,7 +55,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data);
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data);
}
/// <inheritdoc/>

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -57,7 +56,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data);
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data);
}
/// <inheritdoc />

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -68,7 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return base.Equals(other)
&& this.Flags == other.Flags
&& this.Channels.SequenceEqual(other.Channels);
&& this.Channels.AsSpan().SequenceEqual(other.Channels);
}
/// <inheritdoc />

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -56,7 +55,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data);
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data);
}
/// <inheritdoc/>

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -56,7 +55,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data);
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data);
}
/// <inheritdoc/>

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -56,7 +55,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data);
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data);
}
/// <inheritdoc/>

2
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs

@ -56,7 +56,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data);
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data);
}
/// <inheritdoc/>

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -56,7 +55,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data);
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data);
}
/// <inheritdoc/>

5
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -77,8 +76,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
return base.Equals(other)
&& this.UcrCurve.SequenceEqual(other.UcrCurve)
&& this.BgCurve.SequenceEqual(other.BgCurve)
&& this.UcrCurve.AsSpan().SequenceEqual(other.UcrCurve)
&& this.BgCurve.AsSpan().SequenceEqual(other.BgCurve)
&& string.Equals(this.Description, other.Description);
}

3
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -56,7 +55,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return base.Equals(other) && this.Data.SequenceEqual(other.Data);
return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data);
}
/// <inheritdoc/>

7
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccXyzTagDataEntry.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
using System.Numerics;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
@ -15,7 +14,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <summary>
/// Initializes a new instance of the <see cref="IccXyzTagDataEntry"/> class.
/// </summary>
/// <param name="data">The XYZ numbers</param>
/// <param name="data">The XYZ numbers.</param>
public IccXyzTagDataEntry(Vector3[] data)
: this(data, IccProfileTag.Unknown)
{
@ -34,7 +33,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
/// <summary>
/// Gets the XYZ numbers
/// Gets the XYZ numbers.
/// </summary>
public Vector3[] Data { get; }
@ -43,7 +42,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
if (base.Equals(other) && other is IccXyzTagDataEntry entry)
{
return this.Data.SequenceEqual(entry.Data);
return this.Data.AsSpan().SequenceEqual(entry.Data);
}
return false;

4
src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs

@ -130,7 +130,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
&& this.DataType == other.DataType
&& this.InputChannelCount == other.InputChannelCount
&& this.OutputChannelCount == other.OutputChannelCount
&& this.GridPointCount.SequenceEqual(other.GridPointCount);
&& this.GridPointCount.AsSpan().SequenceEqual(other.GridPointCount);
}
/// <inheritdoc/>
@ -162,7 +162,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
for (int i = 0; i < this.Values.Length; i++)
{
if (!this.Values[i].SequenceEqual(other.Values[i]))
if (!this.Values[i].AsSpan().SequenceEqual(other.Values[i]))
{
return false;
}

3
src/ImageSharp/MetaData/Profiles/ICC/Various/IccLut.cs

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
@ -68,7 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
return this.Values.SequenceEqual(other.Values);
return this.Values.AsSpan().SequenceEqual(other.Values);
}
}
}

2
src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs

@ -2,12 +2,14 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Runtime.InteropServices;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
/// <summary>
/// A single channel of a <see cref="IccScreeningTagDataEntry"/>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal readonly struct IccScreeningChannel : IEquatable<IccScreeningChannel>
{
/// <summary>

Loading…
Cancel
Save