diff --git a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj index dfef69b75..89ae566e9 100644 --- a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj +++ b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj @@ -37,8 +37,8 @@ - - + + All diff --git a/src/ImageSharp.Drawing/Paths/ShapeRegion.cs b/src/ImageSharp.Drawing/Paths/ShapeRegion.cs index 1965a7433..a96b03dd0 100644 --- a/src/ImageSharp.Drawing/Paths/ShapeRegion.cs +++ b/src/ImageSharp.Drawing/Paths/ShapeRegion.cs @@ -49,11 +49,11 @@ namespace SixLabors.ImageSharp.Drawing using (var innerBuffer = new Buffer(buffer.Length)) { PointF[] array = innerBuffer.Array; - int count = this.Shape.FindIntersections(start, end, array, offset); + int count = this.Shape.FindIntersections(start, end, array, 0); for (int i = 0; i < count; i++) { - buffer[i] = array[i].X; + buffer[i + offset] = array[i].X; } return count; diff --git a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs index 78231d29a..adf098af4 100644 --- a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs @@ -3,6 +3,7 @@ using System; using System.Buffers; +using System.Diagnostics; using System.Runtime.CompilerServices; using SixLabors.ImageSharp.Drawing; using SixLabors.ImageSharp.Drawing.Brushes; @@ -116,6 +117,10 @@ namespace SixLabors.ImageSharp.Drawing.Processors float subpixelFractionPoint = subpixelFraction / subpixelCount; for (float subPixel = (float)y; subPixel < y + 1; subPixel += subpixelFraction) { + if(y == 102) + { + Debugger.Break(); + } int pointsFound = region.Scan(subPixel, buffer, 0); if (pointsFound == 0) { @@ -123,7 +128,7 @@ namespace SixLabors.ImageSharp.Drawing.Processors continue; } - QuickSort(buffer.AsSpan().Slice(0, pointsFound)); + QuickSort(new Span(buffer, 0, pointsFound)); for (int point = 0; point < pointsFound; point += 2) { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs index f5950a6ef..941807f54 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs @@ -77,7 +77,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = new ShapeRegion(pathMock.Object); pathMock.Setup(x => x.FindIntersections(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Callback>((s, e, b) => { + .Callback((s, e, b, o) => { Assert.Equal(yToScan, s.Y); Assert.Equal(yToScan, e.Y); Assert.True(s.X < bounds.Left); @@ -96,7 +96,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths ShapeRegion region = new ShapeRegion(pathMock.Object); pathMock.Setup(x => x.FindIntersections(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Callback>((s, e, b) => { + .Callback((s, e, b, o) => { Assert.Equal(yToScan, s.Y); Assert.Equal(yToScan, e.Y); Assert.True(s.X < bounds.Left);