Browse Source

Use new HashHelper overloads

pull/783/head
Jason Nelson 7 years ago
parent
commit
ac22630fba
  1. 9
      src/ImageSharp/ColorSpaces/CieLab.cs
  2. 9
      src/ImageSharp/ColorSpaces/CieLch.cs
  3. 9
      src/ImageSharp/ColorSpaces/CieLchuv.cs
  4. 9
      src/ImageSharp/ColorSpaces/CieLuv.cs
  5. 7
      src/ImageSharp/ColorSpaces/CieXyy.cs
  6. 7
      src/ImageSharp/ColorSpaces/CieXyz.cs
  7. 9
      src/ImageSharp/ColorSpaces/Cmyk.cs
  8. 7
      src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs
  9. 6
      src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/GammaWorkingSpace.cs
  10. 3
      src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/RgbWorkingSpaceBase.cs
  11. 7
      src/ImageSharp/ColorSpaces/Hsl.cs
  12. 7
      src/ImageSharp/ColorSpaces/Hsv.cs
  13. 9
      src/ImageSharp/ColorSpaces/HunterLab.cs
  14. 7
      src/ImageSharp/ColorSpaces/LinearRgb.cs
  15. 7
      src/ImageSharp/ColorSpaces/Lms.cs
  16. 7
      src/ImageSharp/ColorSpaces/Rgb.cs
  17. 7
      src/ImageSharp/ColorSpaces/YCbCr.cs
  18. 8
      src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs
  19. 11
      src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
  20. 11
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
  21. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs
  22. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
  23. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
  24. 11
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs
  25. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs
  26. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs
  27. 15
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
  28. 15
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
  29. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
  30. 13
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
  31. 7
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs
  32. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
  33. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs
  34. 11
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
  35. 11
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs
  36. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs
  37. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs
  38. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs
  39. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs
  40. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
  41. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
  42. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs
  43. 13
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs
  44. 5
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs
  45. 13
      src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs
  46. 4
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
  47. 13
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs
  48. 26
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
  49. 10
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs
  50. 11
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
  51. 13
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs
  52. 9
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
  53. 9
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs
  54. 11
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs
  55. 11
      src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs
  56. 3
      src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs
  57. 3
      src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs
  58. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs

9
src/ImageSharp/ColorSpaces/CieLab.cs

@ -120,10 +120,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.L.GetHashCode();
hash = HashHelpers.Combine(hash, this.A.GetHashCode());
hash = HashHelpers.Combine(hash, this.B.GetHashCode());
return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
return HashHelpers.Combine(
this.L.GetHashCode(),
this.A.GetHashCode(),
this.B.GetHashCode(),
this.WhitePoint.GetHashCode());
}
/// <inheritdoc/>

9
src/ImageSharp/ColorSpaces/CieLch.cs

@ -122,10 +122,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.L.GetHashCode();
hash = HashHelpers.Combine(hash, this.C.GetHashCode());
hash = HashHelpers.Combine(hash, this.H.GetHashCode());
return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
return HashHelpers.Combine(
this.L.GetHashCode(),
this.C.GetHashCode(),
this.H.GetHashCode(),
this.WhitePoint.GetHashCode());
}
/// <inheritdoc/>

9
src/ImageSharp/ColorSpaces/CieLchuv.cs

@ -121,10 +121,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.L.GetHashCode();
hash = HashHelpers.Combine(hash, this.C.GetHashCode());
hash = HashHelpers.Combine(hash, this.H.GetHashCode());
return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
return HashHelpers.Combine(
this.L.GetHashCode(),
this.C.GetHashCode(),
this.H.GetHashCode(),
this.WhitePoint.GetHashCode());
}
/// <inheritdoc/>

9
src/ImageSharp/ColorSpaces/CieLuv.cs

@ -121,10 +121,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.L.GetHashCode();
hash = HashHelpers.Combine(hash, this.U.GetHashCode());
hash = HashHelpers.Combine(hash, this.V.GetHashCode());
return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
return HashHelpers.Combine(
this.L.GetHashCode(),
this.U.GetHashCode(),
this.V.GetHashCode(),
this.WhitePoint.GetHashCode());
}
/// <inheritdoc/>

7
src/ImageSharp/ColorSpaces/CieXyy.cs

@ -85,9 +85,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.X.GetHashCode();
hash = HashHelpers.Combine(hash, this.Y.GetHashCode());
return HashHelpers.Combine(hash, this.Yl.GetHashCode());
return HashHelpers.Combine(
this.X.GetHashCode(),
this.Y.GetHashCode(),
this.Yl.GetHashCode());
}
/// <inheritdoc/>

7
src/ImageSharp/ColorSpaces/CieXyz.cs

@ -88,9 +88,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.X.GetHashCode();
hash = HashHelpers.Combine(hash, this.Y.GetHashCode());
return HashHelpers.Combine(hash, this.Z.GetHashCode());
return HashHelpers.Combine(
this.X.GetHashCode(),
this.Y.GetHashCode(),
this.Z.GetHashCode());
}
/// <inheritdoc/>

9
src/ImageSharp/ColorSpaces/Cmyk.cs

@ -92,10 +92,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
int hash = this.C.GetHashCode();
hash = HashHelpers.Combine(hash, this.M.GetHashCode());
hash = HashHelpers.Combine(hash, this.Y.GetHashCode());
return HashHelpers.Combine(hash, this.K.GetHashCode());
return HashHelpers.Combine(
this.C.GetHashCode(),
this.M.GetHashCode(),
this.Y.GetHashCode(),
this.K.GetHashCode());
}
/// <inheritdoc/>

7
src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs

@ -88,12 +88,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
int hashCode = this.R.GetHashCode();
hashCode = (hashCode * 397) ^ this.G.GetHashCode();
return (hashCode * 397) ^ this.B.GetHashCode();
}
return HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode(), this.B.GetHashCode());
}
}
}

6
src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/GammaWorkingSpace.cs

@ -57,10 +57,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation
}
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = base.GetHashCode();
return HashHelpers.Combine(hash, this.Gamma.GetHashCode());
}
public override int GetHashCode() => HashHelpers.Combine(base.GetHashCode(), this.Gamma.GetHashCode());
}
}

3
src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/RgbWorkingSpaceBase.cs

@ -76,8 +76,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.WhitePoint.GetHashCode();
return HashHelpers.Combine(hash, this.ChromaticityCoordinates.GetHashCode());
return HashHelpers.Combine(this.WhitePoint.GetHashCode(), this.ChromaticityCoordinates.GetHashCode());
}
}
}

7
src/ImageSharp/ColorSpaces/Hsl.cs

@ -86,9 +86,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
int hash = this.H.GetHashCode();
hash = HashHelpers.Combine(hash, this.S.GetHashCode());
return HashHelpers.Combine(hash, this.L.GetHashCode());
return HashHelpers.Combine(
this.H.GetHashCode(),
this.S.GetHashCode(),
this.L.GetHashCode());
}
/// <inheritdoc/>

7
src/ImageSharp/ColorSpaces/Hsv.cs

@ -84,9 +84,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
int hash = this.H.GetHashCode();
hash = HashHelpers.Combine(hash, this.S.GetHashCode());
return HashHelpers.Combine(hash, this.V.GetHashCode());
return HashHelpers.Combine(
this.H.GetHashCode(),
this.S.GetHashCode(),
this.V.GetHashCode());
}
/// <inheritdoc/>

9
src/ImageSharp/ColorSpaces/HunterLab.cs

@ -119,10 +119,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
int hash = this.L.GetHashCode();
hash = HashHelpers.Combine(hash, this.A.GetHashCode());
hash = HashHelpers.Combine(hash, this.B.GetHashCode());
return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
return HashHelpers.Combine(
this.L.GetHashCode(),
this.A.GetHashCode(),
this.B.GetHashCode(),
this.WhitePoint.GetHashCode());
}
/// <inheritdoc/>

7
src/ImageSharp/ColorSpaces/LinearRgb.cs

@ -128,9 +128,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
int hash = this.R.GetHashCode();
hash = HashHelpers.Combine(hash, this.G.GetHashCode());
return HashHelpers.Combine(hash, this.B.GetHashCode());
return HashHelpers.Combine(
this.R.GetHashCode(),
this.G.GetHashCode(),
this.B.GetHashCode());
}
/// <inheritdoc/>

7
src/ImageSharp/ColorSpaces/Lms.cs

@ -89,9 +89,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.L.GetHashCode();
hash = HashHelpers.Combine(hash, this.M.GetHashCode());
return HashHelpers.Combine(hash, this.S.GetHashCode());
return HashHelpers.Combine(
this.L.GetHashCode(),
this.M.GetHashCode(),
this.S.GetHashCode());
}
/// <inheritdoc/>

7
src/ImageSharp/ColorSpaces/Rgb.cs

@ -149,9 +149,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
/// <inheritdoc/>
public override int GetHashCode()
{
int hash = this.R.GetHashCode();
hash = HashHelpers.Combine(hash, this.G.GetHashCode());
return HashHelpers.Combine(hash, this.B.GetHashCode());
return HashHelpers.Combine(
this.R.GetHashCode(),
this.G.GetHashCode(),
this.B.GetHashCode());
}
/// <inheritdoc/>

7
src/ImageSharp/ColorSpaces/YCbCr.cs

@ -85,9 +85,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
int hash = this.Y.GetHashCode();
hash = HashHelpers.Combine(hash, this.Cb.GetHashCode());
return HashHelpers.Combine(hash, this.Cr.GetHashCode());
return HashHelpers.Combine(
this.Y.GetHashCode(),
this.Cb.GetHashCode(),
this.Cr.GetHashCode());
}
/// <inheritdoc/>

8
src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs

@ -102,11 +102,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{
return HashHelpers.Combine(
this.DCTEncodeVersion.GetHashCode(),
HashHelpers.Combine(
this.APP14Flags0.GetHashCode(),
HashHelpers.Combine(
this.APP14Flags1.GetHashCode(),
this.ColorTransform.GetHashCode())));
this.APP14Flags0.GetHashCode(),
this.APP14Flags1.GetHashCode(),
this.ColorTransform.GetHashCode());
}
}
}

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

@ -73,13 +73,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
int hashCode = (int)this.CurveType;
hashCode = (hashCode * 397) ^ (this.XyzValues?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (this.ResponseArrays?.GetHashCode() ?? 0);
return hashCode;
}
return HashHelpers.Combine(
(int)this.CurveType,
this.XyzValues.GetHashCode(),
this.ResponseArrays.GetHashCode());
}
private bool EqualsResponseArray(IccResponseCurve other)

11
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs

@ -110,13 +110,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.ColorantType;
hashCode = (hashCode * 397) ^ (this.ChannelValues?.GetHashCode() ?? 0);
return hashCode;
}
return HashHelpers.Combine(
base.GetHashCode(),
(int)this.ColorantType,
this.ChannelValues.GetHashCode());
}
private static double[][] GetColorantArray(IccColorantEncoding colorantType)

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

@ -70,10 +70,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.ColorantNumber?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.ColorantNumber.GetHashCode());
}
}
}

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

@ -72,10 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.ColorantData?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.ColorantData.GetHashCode());
}
}
}

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

@ -118,10 +118,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.CurveData?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.CurveData.GetHashCode());
}
}
}

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

@ -91,13 +91,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (this.Data?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ this.IsAscii.GetHashCode();
return hashCode;
}
return HashHelpers.Combine(
base.GetHashCode(),
this.Data.GetHashCode(),
this.IsAscii.GetHashCode());
}
}
}

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

@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ this.Value.GetHashCode();
}
return HashHelpers.Combine(base.GetHashCode(), this.Value.GetHashCode());
}
}
}

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

@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}

15
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs

@ -62,17 +62,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
: base(IccTypeSignature.Lut16, tagSignature)
{
Guard.NotNull(matrix, nameof(matrix));
Guard.NotNull(inputValues, nameof(inputValues));
Guard.NotNull(clutValues, nameof(clutValues));
Guard.NotNull(outputValues, nameof(outputValues));
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.InputValues = inputValues;
this.ClutValues = clutValues;
this.OutputValues = outputValues;
this.InputValues = inputValues ?? throw new ArgumentNullException(nameof(inputValues));
this.ClutValues = clutValues ?? throw new ArgumentNullException(nameof(clutValues));
this.OutputValues = outputValues ?? throw new ArgumentNullException(nameof(outputValues));
Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size");
Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");
@ -147,9 +144,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.Matrix.GetHashCode();
hashCode = (hashCode * 397) ^ (this.InputValues?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (this.ClutValues?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (this.OutputValues?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ this.InputValues.GetHashCode();
hashCode = (hashCode * 397) ^ this.ClutValues.GetHashCode();
hashCode = (hashCode * 397) ^ this.OutputValues.GetHashCode();
return hashCode;
}
}

15
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs

@ -62,17 +62,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
: base(IccTypeSignature.Lut8, tagSignature)
{
Guard.NotNull(matrix, nameof(matrix));
Guard.NotNull(inputValues, nameof(inputValues));
Guard.NotNull(clutValues, nameof(clutValues));
Guard.NotNull(outputValues, nameof(outputValues));
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.InputValues = inputValues;
this.ClutValues = clutValues;
this.OutputValues = outputValues;
this.InputValues = inputValues ?? throw new ArgumentNullException(nameof(inputValues));
this.ClutValues = clutValues ?? throw new ArgumentNullException(nameof(clutValues));
this.OutputValues = outputValues ?? throw new ArgumentNullException(nameof(outputValues));
Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size");
Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");
@ -150,9 +147,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.Matrix.GetHashCode();
hashCode = (hashCode * 397) ^ (this.InputValues?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (this.ClutValues?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (this.OutputValues?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ this.InputValues.GetHashCode();
hashCode = (hashCode * 397) ^ this.ClutValues.GetHashCode();
hashCode = (hashCode * 397) ^ this.OutputValues.GetHashCode();
return hashCode;
}
}

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

@ -68,10 +68,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Texts?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Texts.GetHashCode());
}
}
}

13
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs

@ -90,14 +90,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.InputChannelCount;
hashCode = (hashCode * 397) ^ this.OutputChannelCount;
hashCode = (hashCode * 397) ^ (this.Data?.GetHashCode() ?? 0);
return hashCode;
}
return HashHelpers.Combine(
base.GetHashCode(),
this.InputChannelCount,
this.OutputChannelCount,
this.Data.GetHashCode());
}
}
}

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

@ -28,7 +28,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public IccParametricCurveTagDataEntry(IccParametricCurve curve, IccProfileTag tagSignature)
: base(IccTypeSignature.ParametricCurve, tagSignature)
{
this.Curve = curve;
this.Curve = curve ?? throw new ArgumentNullException(nameof(curve));
}
/// <summary>
@ -67,10 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Curve?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Curve.GetHashCode());
}
}
}

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

@ -69,10 +69,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Descriptions?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Descriptions.GetHashCode());
}
}
}

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

@ -67,10 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}

11
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs

@ -83,13 +83,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.ChannelCount.GetHashCode();
hashCode = (hashCode * 397) ^ (this.Curves?.GetHashCode() ?? 0);
return hashCode;
}
return HashHelpers.Combine(
base.GetHashCode(),
this.ChannelCount.GetHashCode(),
this.Curves.GetHashCode());
}
}
}

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

@ -77,13 +77,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.Flags;
hashCode = (hashCode * 397) ^ (this.Channels?.GetHashCode() ?? 0);
return hashCode;
}
return HashHelpers.Combine(
base.GetHashCode(),
(int)this.Flags,
this.Channels.GetHashCode());
}
}
}

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

@ -67,10 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.SignatureData?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.SignatureData.GetHashCode());
}
}
}

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

@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Text?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Text.GetHashCode());
}
}
}

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

@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}

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

@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}

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

@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}

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

@ -67,10 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}

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

@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}

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

@ -86,14 +86,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (this.UcrCurve?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (this.BgCurve?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (this.Description?.GetHashCode() ?? 0);
return hashCode;
}
return HashHelpers.Combine(
base.GetHashCode(),
this.UcrCurve.GetHashCode(),
this.BgCurve.GetHashCode(),
this.Description.GetHashCode());
}
}
}

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

@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}

13
src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs

@ -86,14 +86,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.IlluminantXyz.GetHashCode();
hashCode = (hashCode * 397) ^ this.SurroundXyz.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.Illuminant;
return hashCode;
}
return HashHelpers.Combine(
base.GetHashCode(),
this.IlluminantXyz.GetHashCode(),
this.SurroundXyz.GetHashCode(),
(int)this.Illuminant);
}
}
}

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

@ -144,11 +144,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
int hashCode = this.Values?.GetHashCode() ?? 0;
int hashCode = this.Values.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.DataType;
hashCode = (hashCode * 397) ^ this.InputChannelCount;
hashCode = (hashCode * 397) ^ this.OutputChannelCount;
hashCode = (hashCode * 397) ^ (this.GridPointCount?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ this.GridPointCount.GetHashCode();
return hashCode;
}
}

13
src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs

@ -102,14 +102,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = this.Name.GetHashCode();
hashCode = (hashCode * 397) ^ this.Pcs1.GetHashCode();
hashCode = (hashCode * 397) ^ this.Pcs2.GetHashCode();
hashCode = (hashCode * 397) ^ this.Pcs3.GetHashCode();
return hashCode;
}
return HashHelpers.Combine(
this.Name.GetHashCode(),
this.Pcs1.GetHashCode(),
this.Pcs2.GetHashCode(),
this.Pcs3.GetHashCode());
}
/// <inheritdoc/>

26
src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs

@ -80,27 +80,23 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
/// <inheritdoc/>
public bool Equals(IccNamedColor other) =>
this.Name == other.Name &&
this.PcsCoordinates.SequenceEqual(other.PcsCoordinates) &&
this.DeviceCoordinates.SequenceEqual(other.DeviceCoordinates);
public bool Equals(IccNamedColor other)
{
return this.Name.Equals(other.Name)
&& this.PcsCoordinates.SequenceEqual(other.PcsCoordinates)
&& this.DeviceCoordinates.SequenceEqual(other.DeviceCoordinates);
}
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = this.Name.GetHashCode();
hashCode = (hashCode * 397) ^ this.PcsCoordinates.GetHashCode();
hashCode = (hashCode * 397) ^ this.DeviceCoordinates.GetHashCode();
return hashCode;
}
return HashHelpers.Combine(
this.Name.GetHashCode(),
this.PcsCoordinates.GetHashCode(),
this.DeviceCoordinates.GetHashCode());
}
/// <inheritdoc/>
public override string ToString()
{
return this.Name;
}
public override string ToString() => this.Name;
}
}

10
src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs

@ -73,15 +73,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
this.Size == other.Size;
/// <inheritdoc/>
public override int GetHashCode()
{
return unchecked((int)(this.Offset ^ this.Size));
}
public override int GetHashCode() => unchecked((int)(this.Offset ^ this.Size));
/// <inheritdoc/>
public override string ToString()
{
return $"{this.Offset}; {this.Size}";
}
public override string ToString() => $"{this.Offset}; {this.Size}";
}
}

11
src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs

@ -28,15 +28,12 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
IccLocalizedString[] deviceManufacturerInfo,
IccLocalizedString[] deviceModelInfo)
{
Guard.NotNull(deviceManufacturerInfo, nameof(deviceManufacturerInfo));
Guard.NotNull(deviceModelInfo, nameof(deviceModelInfo));
this.DeviceManufacturer = deviceManufacturer;
this.DeviceModel = deviceModel;
this.DeviceAttributes = deviceAttributes;
this.TechnologyInformation = technologyInformation;
this.DeviceManufacturerInfo = deviceManufacturerInfo;
this.DeviceModelInfo = deviceModelInfo;
this.DeviceManufacturerInfo = deviceManufacturerInfo ?? throw new ArgumentNullException(nameof(deviceManufacturerInfo));
this.DeviceModelInfo = deviceModelInfo ?? throw new ArgumentNullException(nameof(deviceModelInfo));
}
/// <summary>
@ -93,8 +90,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
hashCode = (hashCode * 397) ^ (int)this.DeviceModel;
hashCode = (hashCode * 397) ^ this.DeviceAttributes.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.TechnologyInformation;
hashCode = (hashCode * 397) ^ (this.DeviceManufacturerInfo?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (this.DeviceModelInfo?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ this.DeviceManufacturerInfo.GetHashCode();
hashCode = (hashCode * 397) ^ this.DeviceModelInfo.GetHashCode();
return hashCode;
}
}

13
src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs

@ -101,14 +101,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = this.Part1.GetHashCode();
hashCode = (hashCode * 397) ^ this.Part2.GetHashCode();
hashCode = (hashCode * 397) ^ this.Part3.GetHashCode();
hashCode = (hashCode * 397) ^ this.Part4.GetHashCode();
return hashCode;
}
return HashHelpers.Combine(
this.Part1.GetHashCode(),
this.Part2.GetHashCode(),
this.Part3.GetHashCode(),
this.Part4.GetHashCode());
}
/// <inheritdoc/>

9
src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs

@ -18,10 +18,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <param name="description">Description of the profile</param>
public IccProfileSequenceIdentifier(IccProfileId id, IccLocalizedString[] description)
{
Guard.NotNull(description, nameof(description));
this.Id = id;
this.Description = description;
this.Description = description ?? throw new ArgumentNullException(nameof(description));
}
/// <summary>
@ -48,10 +46,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (this.Id.GetHashCode() * 397) ^ (this.Description?.GetHashCode() ?? 0);
}
return HashHelpers.Combine(this.Id.GetHashCode(), this.Description.GetHashCode());
}
}
}

9
src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs

@ -75,12 +75,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = this.DeviceCode.GetHashCode();
hashCode = (hashCode * 397) ^ this.MeasurementValue.GetHashCode();
return hashCode;
}
return HashHelpers.Combine(
this.DeviceCode.GetHashCode(),
this.MeasurementValue.GetHashCode());
}
/// <inheritdoc/>

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

@ -85,13 +85,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = this.Frequency.GetHashCode();
hashCode = (hashCode * 397) ^ this.Angle.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.SpotShape;
return hashCode;
}
return HashHelpers.Combine(
this.Frequency.GetHashCode(),
this.Angle.GetHashCode(),
(int)this.SpotShape);
}
/// <inheritdoc/>

11
src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs

@ -83,13 +83,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// <inheritdoc/>
public override int GetHashCode()
{
unchecked
{
int hashCode = this.Signature.GetHashCode();
hashCode = (hashCode * 397) ^ this.Offset.GetHashCode();
hashCode = (hashCode * 397) ^ this.DataSize.GetHashCode();
return hashCode;
}
return HashHelpers.Combine(
this.Signature.GetHashCode(),
this.Offset.GetHashCode(),
this.DataSize.GetHashCode());
}
/// <inheritdoc/>

3
src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs

@ -191,8 +191,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
int hash = HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode());
return HashHelpers.Combine(hash, this.B.GetHashCode());
return HashHelpers.Combine(this.R.GetHashCode(), this.B.GetHashCode(), this.G.GetHashCode());
}
}
}

3
src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs

@ -202,8 +202,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
int hash = HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode());
return HashHelpers.Combine(hash, this.B.GetHashCode());
return HashHelpers.Combine(this.R.GetHashCode(), this.B.GetHashCode(), this.G.GetHashCode());
}
/// <inheritdoc/>

4
src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs

@ -191,9 +191,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
return HashHelpers.Combine(
this.R.GetHashCode(),
HashHelpers.Combine(this.G.GetHashCode(), this.B.GetHashCode()));
return HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode(), this.B.GetHashCode());
}
}
}
Loading…
Cancel
Save