diff --git a/src/ImageSharp.Drawing.Paths/project.json b/src/ImageSharp.Drawing.Paths/project.json index ee3239e797..c903f805af 100644 --- a/src/ImageSharp.Drawing.Paths/project.json +++ b/src/ImageSharp.Drawing.Paths/project.json @@ -44,7 +44,7 @@ "ImageSharp.Drawing": { "target": "project" }, - "SixLabors.Shapes": "0.1.0-alpha0003", + "SixLabors.Shapes": "0.1.0-alpha0004", "StyleCop.Analyzers": { "version": "1.0.0", "type": "build" diff --git a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs index 4f1ee34ac1..67313d84b6 100644 --- a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs @@ -98,20 +98,7 @@ namespace ImageSharp.Drawing.Processors int pointsFound = this.Region.ScanY(y, buffer, maxIntersections, 0); if (pointsFound == 0) { - // nothign on this line skip - return; - } - - if (pointsFound == 1 && maxIntersections > 1) - { - // we must have clipped a corner lets just duplicate it into point 2 and continue :) - buffer[1] = buffer[0]; - pointsFound++; - } - - if (pointsFound % 2 == 1) - { - // we seem to have just clipped a corner lets just skip it + // nothing on this line skip return; } @@ -253,19 +240,6 @@ namespace ImageSharp.Drawing.Processors return; } - if (pointsFound == 1 && maxIntersections > 1) - { - // we must have clipped a corner lets just duplicate it into point 2 and continue :) - buffer[1] = buffer[0]; - pointsFound++; - } - - if (pointsFound % 2 == 1) - { - // we seem to have just clipped a corner lets just skip it - return; - } - QuickSort(buffer, pointsFound); int currentIntersection = 0; diff --git a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs index 98ec9ff83e..cd3182d6c2 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs @@ -28,14 +28,15 @@ namespace ImageSharp.Tests.Drawing new Vector2(37, 85), new Vector2(93, 85), new Vector2(65, 137))); - + var clipped = simplePath.Clip(hole1); + // var clipped = new Rectangle(10, 10, 100, 100).Clip(new Rectangle(20, 0, 20, 20)); using (Image image = new Image(500, 500)) { using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image .BackgroundColor(Color.Blue) - .Fill(Color.HotPink, simplePath.Clip(hole1)) + .Fill(Color.HotPink, clipped) .Save(output); } @@ -45,6 +46,8 @@ namespace ImageSharp.Tests.Drawing Assert.Equal(Color.HotPink, sourcePixels[200, 150]); + Assert.Equal(Color.HotPink, sourcePixels[70, 137]); + Assert.Equal(Color.HotPink, sourcePixels[50, 50]); Assert.Equal(Color.HotPink, sourcePixels[35, 100]);