Skip to content

Commit f1d51f9

Browse files
Update reference images to match new rasterizer
1 parent 35acddc commit f1d51f9

File tree

280 files changed

+311
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+311
-306
lines changed

tests/ImageSharp.Drawing.Tests/Drawing/FillPolygonTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,25 @@ public void FillPolygon_StarCircle(TestImageProvider<Rgba32> provider)
182182
}
183183

184184
[Theory]
185-
[WithSolidFilledImages(128, 128, "Black", PixelTypes.Rgba32)]
186-
public void FillPolygon_StarCircle_AllOperations(TestImageProvider<Rgba32> provider)
185+
[WithSolidFilledImages(128, 128, "Black", PixelTypes.Rgba32, BooleanOperation.Intersection)]
186+
[WithSolidFilledImages(128, 128, "Black", PixelTypes.Rgba32, BooleanOperation.Union)]
187+
[WithSolidFilledImages(128, 128, "Black", PixelTypes.Rgba32, BooleanOperation.Difference)]
188+
[WithSolidFilledImages(128, 128, "Black", PixelTypes.Rgba32, BooleanOperation.Xor)]
189+
public void FillPolygon_StarCircle_AllOperations(TestImageProvider<Rgba32> provider, BooleanOperation operation)
187190
{
188191
IPath circle = new EllipsePolygon(36, 36, 36).Translate(28, 28);
189192
Star star = new(64, 64, 5, 24, 64);
190193

191194
// See http://www.angusj.com/clipper2/Docs/Units/Clipper/Types/ClipType.htm for reference.
192-
foreach (BooleanOperation operation in (BooleanOperation[])Enum.GetValues(typeof(BooleanOperation)))
193-
{
194-
ShapeOptions options = new() { BooleanOperation = operation };
195-
IPath shape = star.Clip(options, circle);
195+
ShapeOptions options = new() { BooleanOperation = operation };
196+
IPath shape = star.Clip(options, circle);
196197

197-
provider.RunValidatingProcessorTest(
198-
c => c.Fill(Color.DeepPink, circle).Fill(Color.LightGray, star).Fill(Color.ForestGreen, shape),
199-
testOutputDetails: operation.ToString(),
200-
comparer: ImageComparer.TolerantPercentage(0.01F),
201-
appendPixelTypeToFileName: false,
202-
appendSourceFileOrDescription: false);
203-
}
198+
provider.RunValidatingProcessorTest(
199+
c => c.Fill(Color.DeepPink, circle).Fill(Color.LightGray, star).Fill(Color.ForestGreen, shape),
200+
testOutputDetails: operation.ToString(),
201+
comparer: ImageComparer.TolerantPercentage(0.01F),
202+
appendPixelTypeToFileName: false,
203+
appendSourceFileOrDescription: false);
204204
}
205205

206206
[Theory]

tests/ImageSharp.Drawing.Tests/MemoryAllocatorValidator.cs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,13 @@ static MemoryAllocatorValidator()
2020
private static void MemoryDiagnostics_MemoryReleased()
2121
{
2222
TestMemoryDiagnostics backing = LocalInstance.Value;
23-
if (backing != null)
24-
{
25-
backing.TotalRemainingAllocated--;
26-
}
23+
backing?.OnReleased();
2724
}
2825

2926
private static void MemoryDiagnostics_MemoryAllocated()
3027
{
3128
TestMemoryDiagnostics backing = LocalInstance.Value;
32-
if (backing != null)
33-
{
34-
backing.TotalAllocated++;
35-
backing.TotalRemainingAllocated++;
36-
}
29+
backing?.OnAllocated();
3730
}
3831

3932
public static TestMemoryDiagnostics MonitorAllocations()
@@ -48,17 +41,29 @@ public static TestMemoryDiagnostics MonitorAllocations()
4841
public static void ValidateAllocations(int expectedAllocationCount = 0)
4942
=> LocalInstance.Value?.Validate(expectedAllocationCount);
5043

51-
public class TestMemoryDiagnostics : IDisposable
44+
public sealed class TestMemoryDiagnostics : IDisposable
5245
{
53-
public int TotalAllocated { get; set; }
46+
private int totalAllocated;
47+
private int totalRemainingAllocated;
48+
49+
public int TotalAllocated => Volatile.Read(ref this.totalAllocated);
50+
51+
public int TotalRemainingAllocated => Volatile.Read(ref this.totalRemainingAllocated);
52+
53+
internal void OnAllocated()
54+
{
55+
Interlocked.Increment(ref this.totalAllocated);
56+
Interlocked.Increment(ref this.totalRemainingAllocated);
57+
}
5458

55-
public int TotalRemainingAllocated { get; set; }
59+
internal void OnReleased()
60+
=> Interlocked.Decrement(ref this.totalRemainingAllocated);
5661

5762
public void Validate(int expectedAllocationCount)
5863
{
5964
int count = this.TotalRemainingAllocated;
6065
bool pass = expectedAllocationCount == count;
61-
Assert.True(pass, $"Expected a {expectedAllocationCount} undisposed buffers but found {count}");
66+
Assert.True(pass, $"Expected {expectedAllocationCount} undisposed buffers but found {count}");
6267
}
6368

6469
public void Dispose()
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)