Skip to content

Commit 8af75fe

Browse files
Restore GetPixelTypeInfo
1 parent dfd983f commit 8af75fe

File tree

5 files changed

+11
-31
lines changed

5 files changed

+11
-31
lines changed

src/ImageSharp/PixelFormats/IPixel.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ public interface IPixel<TSelf> : IPixel, IEquatable<TSelf>
2222
PixelOperations<TSelf> CreatePixelOperations();
2323

2424
#pragma warning disable CA1000 // Do not declare static members on generic types
25-
26-
/// <summary>
27-
/// Gets the pixel type information.
28-
/// </summary>
29-
/// <returns>The <see cref="PixelTypeInfo"/>.</returns>
30-
static abstract PixelTypeInfo GetPixelTypeInfo();
31-
3225
/// <summary>
3326
/// Initializes the pixel instance from a generic scaled <see cref="Vector4"/>.
3427
/// </summary>
@@ -141,6 +134,12 @@ public interface IPixel<TSelf> : IPixel, IEquatable<TSelf>
141134
/// </summary>
142135
public interface IPixel
143136
{
137+
/// <summary>
138+
/// Gets the pixel type information.
139+
/// </summary>
140+
/// <returns>The <see cref="PixelTypeInfo"/>.</returns>
141+
static abstract PixelTypeInfo GetPixelTypeInfo();
142+
144143
/// <summary>
145144
/// Convert the pixel instance into <see cref="Rgba32"/> representation.
146145
/// </summary>

tests/ImageSharp.Tests/ImageSharp.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,5 @@
8080
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
8181
</ItemGroup>
8282

83-
<ItemGroup>
84-
<Folder Include="Formats\Qoi\" />
85-
</ItemGroup>
86-
8783
</Project>
8884

tests/ImageSharp.Tests/Issues/Issue594.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ namespace SixLabors.ImageSharp.Tests.Issues;
88

99
public class Issue594
1010
{
11-
// This test fails for unknown reason in Release mode on linux and is meant to help reproducing the issue
12-
// see https://github.com/SixLabors/ImageSharp/issues/594
13-
[Fact] // (Skip = "Skipped because of issue #594")]
11+
[Fact]
1412
public void NormalizedByte4Test()
1513
{
1614
// Test PackedValue
@@ -50,9 +48,7 @@ public void NormalizedByte4Test()
5048
Assert.Equal(958796544U, new NormalizedByte4(0.0008f, 0.15f, 0.30f, 0.45f).PackedValue);
5149
}
5250

53-
// This test fails for unknown reason in Release mode on linux and is meant to help reproducing the issue
54-
// see https://github.com/SixLabors/ImageSharp/issues/594
55-
[Fact] //(Skip = "Skipped because of issue #594")]
51+
[Fact]
5652
public void NormalizedShort4Test()
5753
{
5854
// Test PackedValue
@@ -87,9 +83,7 @@ public void NormalizedShort4Test()
8783
Assert.Equal(4150390751449251866UL, new NormalizedShort4(0.0008f, 0.15f, 0.30f, 0.45f).PackedValue);
8884
}
8985

90-
// This test fails for unknown reason in Release mode on linux and is meant to help reproducing the issue
91-
// see https://github.com/SixLabors/ImageSharp/issues/594
92-
[Fact] // (Skip = "Skipped because of issue #594")]
86+
[Fact]
9387
public void Short4Test()
9488
{
9589
// Test the limits.

tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ public void Verify()
12161216

12171217
for (int i = 0; i < count; i++)
12181218
{
1219-
Assert.Equal((IPixel)expected[i], (IPixel)actual[i], comparer);
1219+
Assert.Equal(((IPixel)expected[i]).ToScaledVector4(), ((IPixel)actual[i]).ToScaledVector4(), comparer);
12201220
}
12211221
}
12221222
else
@@ -1231,7 +1231,7 @@ public void Verify()
12311231
}
12321232
}
12331233

1234-
// TODO: We really need a PixelTypeInfo.BitsPerComponent property!!
1234+
// TODO: Figure out a means to use PixelTypeInfo here.
12351235
private static bool IsComplexPixel() => default(TDest) switch
12361236
{
12371237
HalfSingle or HalfVector2 or L16 or La32 or NormalizedShort2 or Rg32 or Short2 => true,

tests/ImageSharp.Tests/TestUtilities/ApproximateFloatComparer.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Diagnostics.CodeAnalysis;
55
using System.Numerics;
66
using System.Runtime.Intrinsics;
7-
using SixLabors.ImageSharp.PixelFormats;
87

98
namespace SixLabors.ImageSharp.Tests;
109

@@ -14,7 +13,6 @@ namespace SixLabors.ImageSharp.Tests;
1413
internal readonly struct ApproximateFloatComparer :
1514
IEqualityComparer<float>,
1615
IEqualityComparer<Vector2>,
17-
IEqualityComparer<IPixel>,
1816
IEqualityComparer<Vector4>,
1917
IEqualityComparer<ColorMatrix>,
2018
IEqualityComparer<Vector256<float>>
@@ -47,13 +45,6 @@ public bool Equals(Vector2 x, Vector2 y)
4745
public int GetHashCode(Vector2 obj)
4846
=> obj.GetHashCode();
4947

50-
/// <inheritdoc/>
51-
public bool Equals(IPixel x, IPixel y)
52-
=> this.Equals(x.ToScaledVector4(), y.ToScaledVector4());
53-
54-
public int GetHashCode(IPixel obj)
55-
=> obj.ToScaledVector4().GetHashCode();
56-
5748
/// <inheritdoc/>
5849
public bool Equals(Vector4 x, Vector4 y)
5950
=> this.Equals(x.X, y.X)

0 commit comments

Comments
 (0)