Skip to content

Commit a0ad69c

Browse files
Remove unused code.
1 parent b63f678 commit a0ad69c

2 files changed

Lines changed: 3 additions & 59 deletions

File tree

src/ImageSharp.Drawing/Shapes/PolygonClipper/PolygonClipper.cs

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ internal sealed class PolygonClipper
3333
private float currentBotY;
3434
private bool isSortedMinimaList;
3535
private bool hasOpenPaths;
36-
private bool usingPolytree;
3736
private bool succeeded;
3837

3938
public PolygonClipper()
@@ -65,9 +64,6 @@ public void AddPath(PathF path, ClippingType polytype, bool isOpen = false)
6564
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6665
public void AddPaths(PathsF paths, ClippingType polytype, bool isOpen = false)
6766
{
68-
// TODO: Remove
69-
this.usingPolytree = false;
70-
7167
if (isOpen)
7268
{
7369
this.hasOpenPaths = true;
@@ -1152,39 +1148,14 @@ private void ProcessHorzJoins()
11521148
or1.pts.OutRec = or1;
11531149
}
11541150

1155-
if (this.usingPolytree)
1156-
{
1157-
if (Path1InsidePath2(or2.pts, or1.pts))
1158-
{
1159-
SetOwner(or2, or1);
1160-
}
1161-
else if (Path1InsidePath2(or1.pts, or2.pts))
1162-
{
1163-
SetOwner(or1, or2);
1164-
}
1165-
else
1166-
{
1167-
or2.owner = or1;
1168-
}
1169-
}
1170-
else
1171-
{
1172-
or2.owner = or1;
1173-
}
1151+
or2.owner = or1;
11741152

11751153
this.outrecList.Add(or2);
11761154
}
11771155
else
11781156
{
11791157
or2.pts = null;
1180-
if (this.usingPolytree)
1181-
{
1182-
SetOwner(or2, or1);
1183-
}
1184-
else
1185-
{
1186-
or2.owner = or1;
1187-
}
1158+
or2.owner = or1;
11881159
}
11891160
}
11901161
}
@@ -1298,12 +1269,6 @@ private void DoSplitOp(OutRec outrec, OutPt splitOp)
12981269
splitOp.OutRec = newOutRec;
12991270
splitOp.Next.OutRec = newOutRec;
13001271

1301-
if (this.usingPolytree)
1302-
{
1303-
outrec.splits ??= new List<int>();
1304-
outrec.splits.Add(newOutRec.idx);
1305-
}
1306-
13071272
OutPt newOp = new(ip, newOutRec) { Prev = splitOp.Next, Next = splitOp };
13081273
newOutRec.pts = newOp;
13091274
splitOp.Prev = newOp;
@@ -2344,11 +2309,6 @@ private OutPt AddLocalMinPoly(Active ae1, Active ae2, Vector2 pt, bool isNew = f
23442309
// the ascending edge (see AddLocalMinPoly).
23452310
if (prevHotEdge != null)
23462311
{
2347-
if (this.usingPolytree)
2348-
{
2349-
SetOwner(outrec, prevHotEdge.outrec!);
2350-
}
2351-
23522312
outrec.owner = prevHotEdge.outrec;
23532313
if (OutrecIsAscending(prevHotEdge) == isNew)
23542314
{
@@ -3300,23 +3260,6 @@ private OutPt AddLocalMaxPoly(Active ae1, Active ae2, Vector2 pt)
33003260
{
33013261
OutRec outrec = ae1.outrec;
33023262
outrec.pts = result;
3303-
3304-
if (this.usingPolytree)
3305-
{
3306-
Active e = GetPrevHotEdge(ae1);
3307-
if (e == null)
3308-
{
3309-
outrec.owner = null;
3310-
}
3311-
else
3312-
{
3313-
SetOwner(outrec, e.outrec!);
3314-
}
3315-
3316-
// nb: outRec.owner here is likely NOT the real
3317-
// owner but this will be fixed in DeepCheckOwner()
3318-
}
3319-
33203263
UncoupleOutRec(ae1);
33213264
}
33223265

src/ImageSharp.Drawing/Shapes/PolygonClipper/PolygonOffsetter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ private static Vector2 GetUnitNormal(Vector2 pt1, Vector2 pt2)
390390
[MethodImpl(MethodImplOptions.AggressiveInlining)]
391391
private void OffsetPolygon(Group group, PathF path)
392392
{
393+
// Dereference the current outpath.
393394
group.OutPath = new(path.Count);
394395
int cnt = path.Count, prev = cnt - 1;
395396
for (int i = 0; i < cnt; i++)

0 commit comments

Comments
 (0)