Browse Source

update SixLabors.Shapes version

fixes missing scan lane while clipping internal corner.
af/merge-core
Scott Williams 9 years ago
parent
commit
60fb2fb775
  1. 2
      src/ImageSharp.Drawing.Paths/project.json
  2. 28
      src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs
  3. 7
      tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs

2
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"

28
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;

7
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]);

Loading…
Cancel
Save