diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs
index abfd6f556c..54633a5d72 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs
@@ -12,17 +12,17 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
internal static class ProfileResolver
{
///
- /// Describes the EXIF specific markers.
+ /// Describes the JFIF specific markers.
///
public static readonly byte[] JFifMarker = Encoding.ASCII.GetBytes("JFIF\0");
///
- /// Describes the EXIF specific markers.
+ /// Describes the ICC specific markers.
///
public static readonly byte[] IccMarker = Encoding.ASCII.GetBytes("ICC_PROFILE\0");
///
- /// Describes the ICC specific markers.
+ /// Describes the EXIF specific markers.
///
public static readonly byte[] ExifMarker = Encoding.ASCII.GetBytes("Exif\0\0");
@@ -36,7 +36,7 @@ internal static class ProfileResolver
///
/// The bytes to check.
/// The profile identifier.
- /// The
+ /// The .
public static bool IsProfile(ReadOnlySpan bytesToCheck, ReadOnlySpan profileIdentifier)
{
return bytesToCheck.Length >= profileIdentifier.Length
diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
index 8bd6514e04..fd0c289b88 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
@@ -4,7 +4,6 @@
using System;
using System.Buffers.Binary;
using System.IO;
-using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Common.Helpers;
@@ -726,7 +725,7 @@ private void ProcessStartOfFrameMarker(int remaining, in JpegFileMarker frameMar
this.InputStream.Read(this.temp, 0, length);
// We only support 8-bit and 12-bit precision.
- if (!this.supportedPrecisions.Contains(this.temp[0]))
+ if (Array.IndexOf(this.supportedPrecisions, this.temp[0]) == -1)
{
JpegThrowHelper.ThrowImageFormatException("Only 8-Bit and 12-Bit precision supported.");
}
diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
index d4ce28107f..0b9eeb609b 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
@@ -4,7 +4,6 @@
using System;
using System.Buffers.Binary;
using System.IO;
-using System.Linq;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Formats.Jpeg.Components;
@@ -197,7 +196,7 @@ public void Encode(Image image, Stream stream)
Guard.NotNull(image, nameof(image));
Guard.NotNull(stream, nameof(stream));
- ushort max = JpegConstants.MaxLength;
+ const ushort max = JpegConstants.MaxLength;
if (image.Width >= max || image.Height >= max)
{
throw new ImageFormatException($"Image is too large to encode at {image.Width}x{image.Height}.");
@@ -226,7 +225,7 @@ public void Encode(Image image, Stream stream)
InitQuantizationTable(1, scale, ref this.chrominanceQuantTable);
// Compute number of components based on input image type.
- int componentCount = 3;
+ const int componentCount = 3;
// Write the Start Of Image marker.
this.WriteApplicationHeader(metadata);
@@ -278,7 +277,7 @@ private static void WriteDataToDqt(byte[] dqt, ref int offset, QuantIndex i, ref
private static void InitQuantizationTable(int i, int scale, ref Block8x8F quant)
{
DebugGuard.MustBeBetweenOrEqualTo(i, 0, 1, nameof(i));
- var unscaledQuant = (i == 0) ? UnscaledQuant_Luminance : UnscaledQuant_Chrominance;
+ ReadOnlySpan unscaledQuant = (i == 0) ? UnscaledQuant_Luminance : UnscaledQuant_Chrominance;
for (int j = 0; j < Block8x8F.Size; j++)
{
@@ -653,8 +652,8 @@ private void WriteExifProfile(ExifProfile exifProfile)
return;
}
- const int MaxBytesApp1 = 65533;
- const int MaxBytesWithExifId = 65527;
+ const int MaxBytesApp1 = 65533; // 64k - 2 padding bytes
+ const int MaxBytesWithExifId = 65527; // Max - 6 bytes for EXIF header.
byte[] data = exifProfile?.ToByteArray();
@@ -663,31 +662,30 @@ private void WriteExifProfile(ExifProfile exifProfile)
return;
}
- data = ProfileResolver.ExifMarker.Concat(data).ToArray();
-
- int remaining = data.Length;
+ // We can write up to a maximum of 64 data to the initial marker so calculate boundaries.
+ int exifMarkerLength = ProfileResolver.ExifMarker.Length;
+ int remaining = exifMarkerLength + data.Length;
int bytesToWrite = remaining > MaxBytesApp1 ? MaxBytesApp1 : remaining;
int app1Length = bytesToWrite + 2;
+ // Write the app marker, EXIF marker, and data
this.WriteApp1Header(app1Length);
-
- // write the exif data
- this.outputStream.Write(data, 0, bytesToWrite);
+ this.outputStream.Write(ProfileResolver.ExifMarker);
+ this.outputStream.Write(data, 0, bytesToWrite - exifMarkerLength);
remaining -= bytesToWrite;
- // if the exif data exceeds 64K, write it in multiple APP1 Markers
- for (int idx = MaxBytesApp1; idx < data.Length; idx += MaxBytesWithExifId)
+ // If the exif data exceeds 64K, write it in multiple APP1 Markers
+ for (int idx = MaxBytesWithExifId; idx < data.Length; idx += MaxBytesWithExifId)
{
bytesToWrite = remaining > MaxBytesWithExifId ? MaxBytesWithExifId : remaining;
- app1Length = bytesToWrite + 2 + 6;
+ app1Length = bytesToWrite + 2 + exifMarkerLength;
this.WriteApp1Header(app1Length);
- // write Exif00 marker
- ProfileResolver.ExifMarker.AsSpan().CopyTo(this.buffer.AsSpan());
- this.outputStream.Write(this.buffer, 0, 6);
+ // Write Exif00 marker
+ this.outputStream.Write(ProfileResolver.ExifMarker);
- // write the exif data
+ // Write the exif data
this.outputStream.Write(data, idx, bytesToWrite);
remaining -= bytesToWrite;
diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
index cbc35f3c3e..def57c3b0e 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
@@ -6,7 +6,6 @@
using System.Buffers.Binary;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced;
@@ -231,7 +230,7 @@ public void Encode(Image image, Stream stream)
if (this.pngColorType == PngColorType.Palette)
{
byte bits = (byte)this.pngBitDepth;
- if (!ColorTypes[this.pngColorType.Value].Contains(bits))
+ if (Array.IndexOf(ColorTypes[this.pngColorType.Value], bits) == -1)
{
throw new NotSupportedException("Bit depth is not supported or not valid.");
}
@@ -268,7 +267,7 @@ public void Encode(Image image, Stream stream)
else
{
this.bitDepth = (byte)this.pngBitDepth;
- if (!ColorTypes[this.pngColorType.Value].Contains(this.bitDepth))
+ if (Array.IndexOf(ColorTypes[this.pngColorType.Value], this.bitDepth) == -1)
{
throw new NotSupportedException("Bit depth is not supported or not valid.");
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
index e1d362a7fe..cbb433012d 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Linq;
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
@@ -52,7 +51,7 @@ public bool Equals(IccOneDimensionalCurve other)
}
return this.BreakPoints.AsSpan().SequenceEqual(other.BreakPoints)
- && this.Segments.SequenceEqual(other.Segments);
+ && this.Segments.AsSpan().SequenceEqual(other.Segments);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
index 4f0345d352..b9a50acd47 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.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
@@ -65,10 +64,7 @@ public bool Equals(IccResponseCurve other)
}
///
- public override bool Equals(object obj)
- {
- return obj is IccResponseCurve other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccResponseCurve other && this.Equals(other);
///
public override int GetHashCode()
@@ -88,7 +84,7 @@ private bool EqualsResponseArray(IccResponseCurve other)
for (int i = 0; i < this.ResponseArrays.Length; i++)
{
- if (!this.ResponseArrays[i].SequenceEqual(other.ResponseArrays[i]))
+ if (!this.ResponseArrays[i].AsSpan().SequenceEqual(other.ResponseArrays[i]))
{
return false;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
index 13fb023d38..f3c632a869 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
@@ -163,10 +163,7 @@ public int WriteTagDataEntryHeader(IccTypeSignature signature)
///
/// The entry to write
/// The number of bytes written
- public int WriteUnknownTagDataEntry(IccUnknownTagDataEntry value)
- {
- return this.WriteArray(value.Data);
- }
+ public int WriteUnknownTagDataEntry(IccUnknownTagDataEntry value) => this.WriteArray(value.Data);
///
/// Writes a
@@ -269,10 +266,7 @@ public int WriteDataTagDataEntry(IccDataTagDataEntry value)
///
/// The entry to write
/// The number of bytes written
- public int WriteDateTimeTagDataEntry(IccDateTimeTagDataEntry value)
- {
- return this.WriteDateTime(value.Value);
- }
+ public int WriteDateTimeTagDataEntry(IccDateTimeTagDataEntry value) => this.WriteDateTime(value.Value);
///
/// Writes a
@@ -563,6 +557,7 @@ public int WriteMultiLocalizedUnicodeTagDataEntry(IccMultiLocalizedUnicodeTagDat
long tpos = this.dataStream.Position;
this.dataStream.Position += cultureCount * 12;
+ // TODO: Investigate cost of Linq GroupBy
IGrouping[] texts = value.Texts.GroupBy(t => t.Text).ToArray();
uint[] offset = new uint[texts.Length];
@@ -625,7 +620,7 @@ public int WriteMultiProcessElementsTagDataEntry(IccMultiProcessElementsTagDataE
long tpos = this.dataStream.Position;
this.dataStream.Position += value.Data.Length * 8;
- IccPositionNumber[] posTable = new IccPositionNumber[value.Data.Length];
+ var posTable = new IccPositionNumber[value.Data.Length];
for (int i = 0; i < value.Data.Length; i++)
{
uint offset = (uint)(this.dataStream.Position - start);
@@ -673,10 +668,7 @@ public int WriteNamedColor2TagDataEntry(IccNamedColor2TagDataEntry value)
///
/// The entry to write
/// The number of bytes written
- public int WriteParametricCurveTagDataEntry(IccParametricCurveTagDataEntry value)
- {
- return this.WriteParametricCurve(value.Curve);
- }
+ public int WriteParametricCurveTagDataEntry(IccParametricCurveTagDataEntry value) => this.WriteParametricCurve(value.Curve);
///
/// Writes a
@@ -793,20 +785,14 @@ public int WriteFix16ArrayTagDataEntry(IccFix16ArrayTagDataEntry value)
///
/// The entry to write
/// The number of bytes written
- public int WriteSignatureTagDataEntry(IccSignatureTagDataEntry value)
- {
- return this.WriteAsciiString(value.SignatureData, 4, false);
- }
+ public int WriteSignatureTagDataEntry(IccSignatureTagDataEntry value) => this.WriteAsciiString(value.SignatureData, 4, false);
///
/// Writes a
///
/// The entry to write
/// The number of bytes written
- public int WriteTextTagDataEntry(IccTextTagDataEntry value)
- {
- return this.WriteAsciiString(value.Text);
- }
+ public int WriteTextTagDataEntry(IccTextTagDataEntry value) => this.WriteAsciiString(value.Text);
///
/// Writes a
@@ -829,40 +815,28 @@ public int WriteUFix16ArrayTagDataEntry(IccUFix16ArrayTagDataEntry value)
///
/// The entry to write
/// The number of bytes written
- public int WriteUInt16ArrayTagDataEntry(IccUInt16ArrayTagDataEntry value)
- {
- return this.WriteArray(value.Data);
- }
+ public int WriteUInt16ArrayTagDataEntry(IccUInt16ArrayTagDataEntry value) => this.WriteArray(value.Data);
///
/// Writes a
///
/// The entry to write
/// The number of bytes written
- public int WriteUInt32ArrayTagDataEntry(IccUInt32ArrayTagDataEntry value)
- {
- return this.WriteArray(value.Data);
- }
+ public int WriteUInt32ArrayTagDataEntry(IccUInt32ArrayTagDataEntry value) => this.WriteArray(value.Data);
///
/// Writes a
///
/// The entry to write
/// The number of bytes written
- public int WriteUInt64ArrayTagDataEntry(IccUInt64ArrayTagDataEntry value)
- {
- return this.WriteArray(value.Data);
- }
+ public int WriteUInt64ArrayTagDataEntry(IccUInt64ArrayTagDataEntry value) => this.WriteArray(value.Data);
///
/// Writes a
///
/// The entry to write
/// The number of bytes written
- public int WriteUInt8ArrayTagDataEntry(IccUInt8ArrayTagDataEntry value)
- {
- return this.WriteArray(value.Data);
- }
+ public int WriteUInt8ArrayTagDataEntry(IccUInt8ArrayTagDataEntry value) => this.WriteArray(value.Data);
///
/// Writes a
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/IccWriter.cs b/src/ImageSharp/MetaData/Profiles/ICC/IccWriter.cs
index b5a7c830dd..186f06df05 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/IccWriter.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/IccWriter.cs
@@ -70,6 +70,7 @@ private void WriteTagTable(IccDataWriter writer, IccTagTableEntry[] table)
private IccTagTableEntry[] WriteTagData(IccDataWriter writer, IccTagDataEntry[] entries)
{
+ // TODO: Investigate cost of Linq GroupBy
IEnumerable> grouped = entries.GroupBy(t => t);
// (Header size) + (entry count) + (nr of entries) * (size of table entry)
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs b/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs
index d72aff3c92..c6409e3c1d 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Linq;
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
@@ -17,9 +16,7 @@ internal sealed class IccCurveSetProcessElement : IccMultiProcessElement, IEquat
/// An array with one dimensional curves
public IccCurveSetProcessElement(IccOneDimensionalCurve[] curves)
: base(IccMultiProcessElementSignature.CurveSet, curves?.Length ?? 1, curves?.Length ?? 1)
- {
- this.Curves = curves ?? throw new ArgumentNullException(nameof(curves));
- }
+ => this.Curves = curves ?? throw new ArgumentNullException(nameof(curves));
///
/// Gets an array of one dimensional curves
@@ -31,16 +28,13 @@ public override bool Equals(IccMultiProcessElement other)
{
if (base.Equals(other) && other is IccCurveSetProcessElement element)
{
- return this.Curves.SequenceEqual(element.Curves);
+ return this.Curves.AsSpan().SequenceEqual(element.Curves);
}
return false;
}
///
- public bool Equals(IccCurveSetProcessElement other)
- {
- return this.Equals((IccMultiProcessElement)other);
- }
+ public bool Equals(IccCurveSetProcessElement other) => this.Equals((IccMultiProcessElement)other);
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
index b4d711f59e..813271d48b 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
@@ -80,10 +80,7 @@ private IccChromaticityTagDataEntry(IccColorantEncoding colorantType, double[][]
public double[][] ChannelValues { get; }
///
- public override bool Equals(IccTagDataEntry other)
- {
- return other is IccChromaticityTagDataEntry entry && this.Equals(entry);
- }
+ public override bool Equals(IccTagDataEntry other) => other is IccChromaticityTagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccChromaticityTagDataEntry other)
@@ -102,10 +99,7 @@ public bool Equals(IccChromaticityTagDataEntry other)
}
///
- public override bool Equals(object obj)
- {
- return obj is IccChromaticityTagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccChromaticityTagDataEntry other && this.Equals(other);
///
public override int GetHashCode()
@@ -162,7 +156,7 @@ private bool EqualsChannelValues(IccChromaticityTagDataEntry entry)
for (int i = 0; i < this.ChannelValues.Length; i++)
{
- if (!this.ChannelValues[i].SequenceEqual(entry.ChannelValues[i]))
+ if (!this.ChannelValues[i].AsSpan().SequenceEqual(entry.ChannelValues[i]))
{
return false;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
index 28d01450c1..aff33ff828 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Linq;
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
@@ -42,10 +41,7 @@ public IccColorantTableTagDataEntry(IccColorantTableEntry[] colorantData, IccPro
public IccColorantTableEntry[] ColorantData { get; }
///
- public override bool Equals(IccTagDataEntry other)
- {
- return other is IccColorantTableTagDataEntry entry && this.Equals(entry);
- }
+ public override bool Equals(IccTagDataEntry other) => other is IccColorantTableTagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccColorantTableTagDataEntry other)
@@ -60,19 +56,13 @@ public bool Equals(IccColorantTableTagDataEntry other)
return true;
}
- return base.Equals(other) && this.ColorantData.SequenceEqual(other.ColorantData);
+ return base.Equals(other) && this.ColorantData.AsSpan().SequenceEqual(other.ColorantData);
}
///
- public override bool Equals(object obj)
- {
- return obj is IccColorantTableTagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccColorantTableTagDataEntry other && this.Equals(other);
///
- public override int GetHashCode()
- {
- return HashCode.Combine(this.Signature, this.ColorantData);
- }
+ public override int GetHashCode() => HashCode.Combine(this.Signature, this.ColorantData);
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
index d84fc1431e..8f7db49ad0 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.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
@@ -71,7 +70,7 @@ public IccLut16TagDataEntry(float[,] matrix, IccLut[] inputValues, IccClut clutV
bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3;
Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three");
- this.Matrix = this.CreateMatrix(matrix);
+ this.Matrix = CreateMatrix(matrix);
this.InputValues = inputValues ?? throw new ArgumentNullException(nameof(inputValues));
this.ClutValues = clutValues ?? throw new ArgumentNullException(nameof(clutValues));
this.OutputValues = outputValues ?? throw new ArgumentNullException(nameof(outputValues));
@@ -111,10 +110,7 @@ public IccLut16TagDataEntry(float[,] matrix, IccLut[] inputValues, IccClut clutV
public IccLut[] OutputValues { get; }
///
- public override bool Equals(IccTagDataEntry other)
- {
- return other is IccLut16TagDataEntry entry && this.Equals(entry);
- }
+ public override bool Equals(IccTagDataEntry other) => other is IccLut16TagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccLut16TagDataEntry other)
@@ -131,16 +127,13 @@ public bool Equals(IccLut16TagDataEntry other)
return base.Equals(other)
&& this.Matrix.Equals(other.Matrix)
- && this.InputValues.SequenceEqual(other.InputValues)
+ && this.InputValues.AsSpan().SequenceEqual(other.InputValues)
&& this.ClutValues.Equals(other.ClutValues)
- && this.OutputValues.SequenceEqual(other.OutputValues);
+ && this.OutputValues.AsSpan().SequenceEqual(other.OutputValues);
}
///
- public override bool Equals(object obj)
- {
- return obj is IccLut16TagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccLut16TagDataEntry other && this.Equals(other);
///
public override int GetHashCode()
@@ -153,7 +146,7 @@ public override int GetHashCode()
this.OutputValues);
}
- private Matrix4x4 CreateMatrix(float[,] matrix)
+ private static Matrix4x4 CreateMatrix(float[,] matrix)
{
return new Matrix4x4(
matrix[0, 0],
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
index 5c8ce2d2c9..3a1859a1c3 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
@@ -114,10 +114,7 @@ public IccLut8TagDataEntry(float[,] matrix, IccLut[] inputValues, IccClut clutVa
public IccLut[] OutputValues { get; }
///
- public override bool Equals(IccTagDataEntry other)
- {
- return other is IccLut8TagDataEntry entry && this.Equals(entry);
- }
+ public override bool Equals(IccTagDataEntry other) => other is IccLut8TagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccLut8TagDataEntry other)
@@ -134,16 +131,13 @@ public bool Equals(IccLut8TagDataEntry other)
return base.Equals(other)
&& this.Matrix.Equals(other.Matrix)
- && this.InputValues.SequenceEqual(other.InputValues)
+ && this.InputValues.AsSpan().SequenceEqual(other.InputValues)
&& this.ClutValues.Equals(other.ClutValues)
- && this.OutputValues.SequenceEqual(other.OutputValues);
+ && this.OutputValues.AsSpan().SequenceEqual(other.OutputValues);
}
///
- public override bool Equals(object obj)
- {
- return obj is IccLut8TagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccLut8TagDataEntry other && this.Equals(other);
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs
index 4cee555e51..88e3c4cae2 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs
@@ -5,6 +5,7 @@
using System.Linq;
using System.Numerics;
+// TODO: Review the use of base IccTagDataEntry comparison.
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
///
@@ -15,12 +16,12 @@ internal sealed class IccLutAToBTagDataEntry : IccTagDataEntry, IEquatable
/// Initializes a new instance of the class.
///
- /// A Curve
- /// CLUT
- /// M Curve
+ /// B Curve
/// Two dimensional conversion matrix (3x3)
/// One dimensional conversion matrix (3x1)
- /// B Curve
+ /// M Curve
+ /// CLUT
+ /// A Curve
public IccLutAToBTagDataEntry(
IccTagDataEntry[] curveB,
float[,] matrix3x3,
@@ -35,12 +36,12 @@ public IccLutAToBTagDataEntry(
///
/// Initializes a new instance of the class.
///
- /// A Curve
- /// CLUT
- /// M Curve
+ /// B Curve
/// Two dimensional conversion matrix (3x3)
/// One dimensional conversion matrix (3x1)
- /// B Curve
+ /// M Curve
+ /// CLUT
+ /// A Curve
/// Tag Signature
public IccLutAToBTagDataEntry(
IccTagDataEntry[] curveB,
@@ -145,10 +146,7 @@ public IccLutAToBTagDataEntry(
public IccTagDataEntry[] CurveA { get; }
///
- public override bool Equals(IccTagDataEntry other)
- {
- return other is IccLutAToBTagDataEntry entry && this.Equals(entry);
- }
+ public override bool Equals(IccTagDataEntry other) => other is IccLutAToBTagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccLutAToBTagDataEntry other)
@@ -169,23 +167,18 @@ public bool Equals(IccLutAToBTagDataEntry other)
&& this.Matrix3x3.Equals(other.Matrix3x3)
&& this.Matrix3x1.Equals(other.Matrix3x1)
&& this.ClutValues.Equals(other.ClutValues)
- && this.EqualsCurve(this.CurveB, other.CurveB)
- && this.EqualsCurve(this.CurveM, other.CurveM)
- && this.EqualsCurve(this.CurveA, other.CurveA);
+ && EqualsCurve(this.CurveB, other.CurveB)
+ && EqualsCurve(this.CurveM, other.CurveM)
+ && EqualsCurve(this.CurveA, other.CurveA);
}
///
- public override bool Equals(object obj)
- {
- return obj is IccLutAToBTagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccLutAToBTagDataEntry other && this.Equals(other);
///
public override int GetHashCode()
{
-#pragma warning disable SA1129 // Do not use default value type constructor
- var hashCode = new HashCode();
-#pragma warning restore SA1129 // Do not use default value type constructor
+ HashCode hashCode = default;
hashCode.Add(this.Signature);
hashCode.Add(this.InputChannelCount);
@@ -200,7 +193,7 @@ public override int GetHashCode()
return hashCode.ToHashCode();
}
- private bool EqualsCurve(IccTagDataEntry[] thisCurves, IccTagDataEntry[] entryCurves)
+ private static bool EqualsCurve(IccTagDataEntry[] thisCurves, IccTagDataEntry[] entryCurves)
{
bool thisNull = thisCurves is null;
bool entryNull = entryCurves is null;
@@ -243,10 +236,7 @@ private bool IsAClutB()
&& this.CurveA != null;
}
- private bool IsB()
- {
- return this.CurveB != null;
- }
+ private bool IsB() => this.CurveB != null;
private void VerifyCurve(IccTagDataEntry[] curves, string name)
{
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs
index 8e9479ff83..f8bf3f0423 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs
@@ -5,6 +5,7 @@
using System.Linq;
using System.Numerics;
+// TODO: Review the use of base IccTagDataEntry comparison.
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
///
@@ -15,12 +16,12 @@ internal sealed class IccLutBToATagDataEntry : IccTagDataEntry, IEquatable
/// Initializes a new instance of the class.
///
- /// A Curve
- /// CLUT
- /// M Curve
+ /// B Curve
/// Two dimensional conversion matrix (3x3)
/// One dimensional conversion matrix (3x1)
- /// B Curve
+ /// M Curve
+ /// CLUT
+ /// A Curve
public IccLutBToATagDataEntry(
IccTagDataEntry[] curveB,
float[,] matrix3x3,
@@ -35,12 +36,12 @@ public IccLutBToATagDataEntry(
///
/// Initializes a new instance of the class.
///
- /// A Curve
- /// CLUT
- /// M Curve
+ /// B Curve
/// Two dimensional conversion matrix (3x3)
/// One dimensional conversion matrix (3x1)
- /// B Curve
+ /// M Curve
+ /// CLUT
+ /// A Curve
/// Tag Signature
public IccLutBToATagDataEntry(
IccTagDataEntry[] curveB,
@@ -145,10 +146,7 @@ public IccLutBToATagDataEntry(
public IccTagDataEntry[] CurveA { get; }
///
- public override bool Equals(IccTagDataEntry other)
- {
- return other is IccLutBToATagDataEntry entry && this.Equals(entry);
- }
+ public override bool Equals(IccTagDataEntry other) => other is IccLutBToATagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccLutBToATagDataEntry other)
@@ -175,18 +173,12 @@ public bool Equals(IccLutBToATagDataEntry other)
}
///
- public override bool Equals(object obj)
- {
- return obj is IccLutBToATagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccLutBToATagDataEntry other && this.Equals(other);
///
public override int GetHashCode()
{
-#pragma warning disable SA1129 // Do not use default value type constructor
- var hashCode = new HashCode();
-#pragma warning restore SA1129 // Do not use default value type constructor
-
+ HashCode hashCode = default;
hashCode.Add(this.Signature);
hashCode.Add(this.InputChannelCount);
hashCode.Add(this.OutputChannelCount);
@@ -243,10 +235,7 @@ private bool IsBClutA()
&& this.CurveA != null;
}
- private bool IsB()
- {
- return this.CurveB != null;
- }
+ private bool IsB() => this.CurveB != null;
private void VerifyCurve(IccTagDataEntry[] curves, string name)
{
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
index 3084ff6121..34a027126f 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.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 @@ public bool Equals(IccMultiLocalizedUnicodeTagDataEntry other)
return true;
}
- return base.Equals(other) && this.Texts.SequenceEqual(other.Texts);
+ return base.Equals(other) && this.Texts.AsSpan().SequenceEqual(other.Texts);
}
///
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
index dc78e75200..f2713e8cee 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
@@ -57,10 +57,7 @@ public IccMultiProcessElementsTagDataEntry(IccMultiProcessElement[] data, IccPro
///
public override bool Equals(IccTagDataEntry other)
- {
- var entry = other as IccMultiProcessElementsTagDataEntry;
- return entry != null && this.Equals(entry);
- }
+ => other is IccMultiProcessElementsTagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccMultiProcessElementsTagDataEntry other)
@@ -78,14 +75,11 @@ public bool Equals(IccMultiProcessElementsTagDataEntry other)
return base.Equals(other)
&& this.InputChannelCount == other.InputChannelCount
&& this.OutputChannelCount == other.OutputChannelCount
- && this.Data.SequenceEqual(other.Data);
+ && this.Data.AsSpan().SequenceEqual(other.Data);
}
///
- public override bool Equals(object obj)
- {
- return obj is IccMultiProcessElementsTagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccMultiProcessElementsTagDataEntry other && this.Equals(other);
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs
index 30516578fe..4fd0cfcfb6 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs
@@ -143,7 +143,7 @@ public bool Equals(IccNamedColor2TagDataEntry other)
&& string.Equals(this.Prefix, other.Prefix)
&& string.Equals(this.Suffix, other.Suffix)
&& this.VendorFlags == other.VendorFlags
- && this.Colors.SequenceEqual(other.Colors);
+ && this.Colors.AsSpan().SequenceEqual(other.Colors);
}
///
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
index 3c3a6c7619..7897c394f1 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Linq;
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
@@ -29,9 +28,7 @@ public IccProfileSequenceDescTagDataEntry(IccProfileDescription[] descriptions)
/// Tag Signature
public IccProfileSequenceDescTagDataEntry(IccProfileDescription[] descriptions, IccProfileTag tagSignature)
: base(IccTypeSignature.ProfileSequenceDesc, tagSignature)
- {
- this.Descriptions = descriptions ?? throw new ArgumentNullException(nameof(descriptions));
- }
+ => this.Descriptions = descriptions ?? throw new ArgumentNullException(nameof(descriptions));
///
/// Gets the profile descriptions
@@ -40,9 +37,7 @@ public IccProfileSequenceDescTagDataEntry(IccProfileDescription[] descriptions,
///
public override bool Equals(IccTagDataEntry other)
- {
- return other is IccProfileSequenceDescTagDataEntry entry && this.Equals(entry);
- }
+ => other is IccProfileSequenceDescTagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccProfileSequenceDescTagDataEntry other)
@@ -57,14 +52,12 @@ public bool Equals(IccProfileSequenceDescTagDataEntry other)
return true;
}
- return base.Equals(other) && this.Descriptions.SequenceEqual(other.Descriptions);
+ return base.Equals(other) && this.Descriptions.AsSpan().SequenceEqual(other.Descriptions);
}
///
public override bool Equals(object obj)
- {
- return obj is IccProfileSequenceDescTagDataEntry other && this.Equals(other);
- }
+ => obj is IccProfileSequenceDescTagDataEntry other && this.Equals(other);
///
public override int GetHashCode() => HashCode.Combine(this.Signature, this.Descriptions);
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
index 6051bf8414..e9c8af9be2 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
@@ -51,10 +51,7 @@ public IccResponseCurveSet16TagDataEntry(IccResponseCurve[] curves, IccProfileTa
public IccResponseCurve[] Curves { get; }
///
- public override bool Equals(IccTagDataEntry other)
- {
- return other is IccResponseCurveSet16TagDataEntry entry && this.Equals(entry);
- }
+ public override bool Equals(IccTagDataEntry other) => other is IccResponseCurveSet16TagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccResponseCurveSet16TagDataEntry other)
@@ -71,14 +68,11 @@ public bool Equals(IccResponseCurveSet16TagDataEntry other)
return base.Equals(other)
&& this.ChannelCount == other.ChannelCount
- && this.Curves.SequenceEqual(other.Curves);
+ && this.Curves.AsSpan().SequenceEqual(other.Curves);
}
///
- public override bool Equals(object obj)
- {
- return obj is IccResponseCurveSet16TagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccResponseCurveSet16TagDataEntry other && this.Equals(other);
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
index 053181a26f..09bec9b7a5 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Linq;
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
@@ -26,10 +25,7 @@ public IccUInt64ArrayTagDataEntry(ulong[] data)
/// The array data
/// Tag Signature
public IccUInt64ArrayTagDataEntry(ulong[] data, IccProfileTag tagSignature)
- : base(IccTypeSignature.UInt64Array, tagSignature)
- {
- this.Data = data ?? throw new ArgumentNullException(nameof(data));
- }
+ : base(IccTypeSignature.UInt64Array, tagSignature) => this.Data = data ?? throw new ArgumentNullException(nameof(data));
///
/// Gets the array data
@@ -37,10 +33,7 @@ public IccUInt64ArrayTagDataEntry(ulong[] data, IccProfileTag tagSignature)
public ulong[] Data { get; }
///
- public override bool Equals(IccTagDataEntry other)
- {
- return other is IccUInt64ArrayTagDataEntry entry && this.Equals(entry);
- }
+ public override bool Equals(IccTagDataEntry other) => other is IccUInt64ArrayTagDataEntry entry && this.Equals(entry);
///
public bool Equals(IccUInt64ArrayTagDataEntry other)
@@ -59,10 +52,7 @@ public bool Equals(IccUInt64ArrayTagDataEntry other)
}
///
- public override bool Equals(object obj)
- {
- return obj is IccUInt64ArrayTagDataEntry other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccUInt64ArrayTagDataEntry other && this.Equals(other);
///
public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data);
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
index c53ba95201..bd8f784ae7 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
@@ -134,10 +134,7 @@ public bool Equals(IccClut other)
}
///
- public override bool Equals(object obj)
- {
- return obj is IccClut other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccClut other && this.Equals(other);
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
index 22bf1bb762..3c640ab036 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Linq;
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
@@ -55,10 +54,7 @@ public IccNamedColor(string name, ushort[] pcsCoordinates, ushort[] deviceCoordi
///
/// True if the parameter is equal to the parameter; otherwise, false.
///
- public static bool operator ==(IccNamedColor left, IccNamedColor right)
- {
- return left.Equals(right);
- }
+ public static bool operator ==(IccNamedColor left, IccNamedColor right) => left.Equals(right);
///
/// Compares two objects for equality.
@@ -68,23 +64,17 @@ public IccNamedColor(string name, ushort[] pcsCoordinates, ushort[] deviceCoordi
///
/// True if the parameter is not equal to the parameter; otherwise, false.
///
- public static bool operator !=(IccNamedColor left, IccNamedColor right)
- {
- return !left.Equals(right);
- }
+ public static bool operator !=(IccNamedColor left, IccNamedColor right) => !left.Equals(right);
///
- public override bool Equals(object obj)
- {
- return obj is IccNamedColor other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccNamedColor other && this.Equals(other);
///
public bool Equals(IccNamedColor other)
{
return this.Name.Equals(other.Name)
- && this.PcsCoordinates.SequenceEqual(other.PcsCoordinates)
- && this.DeviceCoordinates.SequenceEqual(other.DeviceCoordinates);
+ && this.PcsCoordinates.AsSpan().SequenceEqual(other.PcsCoordinates)
+ && this.DeviceCoordinates.AsSpan().SequenceEqual(other.DeviceCoordinates);
}
///
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
index 76ac5961d9..d630f015e9 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.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,18 +67,15 @@ public IccProfileDescription(
///
public bool Equals(IccProfileDescription other) =>
- this.DeviceManufacturer == other.DeviceManufacturer &&
- this.DeviceModel == other.DeviceModel &&
- this.DeviceAttributes == other.DeviceAttributes &&
- this.TechnologyInformation == other.TechnologyInformation &&
- this.DeviceManufacturerInfo.SequenceEqual(other.DeviceManufacturerInfo) &&
- this.DeviceModelInfo.SequenceEqual(other.DeviceModelInfo);
+ this.DeviceManufacturer == other.DeviceManufacturer
+ && this.DeviceModel == other.DeviceModel
+ && this.DeviceAttributes == other.DeviceAttributes
+ && this.TechnologyInformation == other.TechnologyInformation
+ && this.DeviceManufacturerInfo.AsSpan().SequenceEqual(other.DeviceManufacturerInfo)
+ && this.DeviceModelInfo.AsSpan().SequenceEqual(other.DeviceModelInfo);
///
- public override bool Equals(object obj)
- {
- return obj is IccProfileDescription other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccProfileDescription other && this.Equals(other);
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
index 9eb9fc7c3e..6bf420b49e 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.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,14 +33,11 @@ public IccProfileSequenceIdentifier(IccProfileId id, IccLocalizedString[] descri
///
public bool Equals(IccProfileSequenceIdentifier other) =>
- this.Id.Equals(other.Id) &&
- this.Description.SequenceEqual(other.Description);
+ this.Id.Equals(other.Id)
+ && this.Description.AsSpan().SequenceEqual(other.Description);
///
- public override bool Equals(object obj)
- {
- return obj is IccProfileSequenceIdentifier other && this.Equals(other);
- }
+ public override bool Equals(object obj) => obj is IccProfileSequenceIdentifier other && this.Equals(other);
///
public override int GetHashCode() => HashCode.Combine(this.Id, this.Description);
diff --git a/src/ImageSharp/Processing/ResizeOptions.cs b/src/ImageSharp/Processing/ResizeOptions.cs
index 0d5bfe38bc..ee0dde6b27 100644
--- a/src/ImageSharp/Processing/ResizeOptions.cs
+++ b/src/ImageSharp/Processing/ResizeOptions.cs
@@ -1,8 +1,8 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
+using System;
using System.Collections.Generic;
-using System.Linq;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
using SixLabors.Primitives;
@@ -26,7 +26,7 @@ public class ResizeOptions
///
/// Gets or sets the center coordinates.
///
- public IEnumerable CenterCoordinates { get; set; } = Enumerable.Empty();
+ public IEnumerable CenterCoordinates { get; set; } = Array.Empty();
///
/// Gets or sets the target size.