|
6 | 6 | using System.Collections.Generic; |
7 | 7 | using System.Linq; |
8 | 8 | using System.Numerics; |
9 | | -using SixLabors.ImageSharp.Drawing.Utilities; |
10 | 9 |
|
11 | 10 | namespace SixLabors.ImageSharp.Drawing |
12 | 11 | { |
@@ -173,61 +172,6 @@ public IPath AsClosedPath() |
173 | 172 | return new ComplexPolygon(paths); |
174 | 173 | } |
175 | 174 |
|
176 | | - /// <inheritdoc /> |
177 | | - int IPathInternals.FindIntersections(PointF start, PointF end, Span<PointF> intersections, Span<PointOrientation> orientations) |
178 | | - => ((IPathInternals)this).FindIntersections(start, end, intersections, orientations, IntersectionRule.OddEven); |
179 | | - |
180 | | - /// <inheritdoc /> |
181 | | - int IPathInternals.FindIntersections( |
182 | | - PointF start, |
183 | | - PointF end, |
184 | | - Span<PointF> intersections, |
185 | | - Span<PointOrientation> orientations, |
186 | | - IntersectionRule intersectionRule) |
187 | | - { |
188 | | - int totalAdded = 0; |
189 | | - foreach (InternalPath ip in this.internalPaths) |
190 | | - { |
191 | | - Span<PointF> subBuffer = intersections.Slice(totalAdded); |
192 | | - Span<PointOrientation> subOrientationsSpan = orientations.Slice(totalAdded); |
193 | | - |
194 | | - int position = ip.FindIntersectionsWithOrientation(start, end, subBuffer, subOrientationsSpan); |
195 | | - totalAdded += position; |
196 | | - } |
197 | | - |
198 | | - // Avoid pool overhead for short runs. |
199 | | - // This method can be called in high volume. |
200 | | - const int maxStackSize = 1024 / sizeof(float); |
201 | | - float[] rentedFromPool = null; |
202 | | - Span<float> buffer = |
203 | | - totalAdded > maxStackSize |
204 | | - ? (rentedFromPool = ArrayPool<float>.Shared.Rent(totalAdded)) |
205 | | - : stackalloc float[maxStackSize]; |
206 | | - |
207 | | - Span<float> distances = buffer.Slice(0, totalAdded); |
208 | | - |
209 | | - for (int i = 0; i < totalAdded; i++) |
210 | | - { |
211 | | - distances[i] = Vector2.DistanceSquared(start, intersections[i]); |
212 | | - } |
213 | | - |
214 | | - Span<PointF> activeIntersections = intersections.Slice(0, totalAdded); |
215 | | - Span<PointOrientation> activeOrientations = orientations.Slice(0, totalAdded); |
216 | | - SortUtility.Sort(distances, activeIntersections, activeOrientations); |
217 | | - |
218 | | - if (intersectionRule == IntersectionRule.Nonzero) |
219 | | - { |
220 | | - totalAdded = InternalPath.ApplyNonZeroIntersectionRules(activeIntersections, activeOrientations); |
221 | | - } |
222 | | - |
223 | | - if (rentedFromPool != null) |
224 | | - { |
225 | | - ArrayPool<float>.Shared.Return(rentedFromPool); |
226 | | - } |
227 | | - |
228 | | - return totalAdded; |
229 | | - } |
230 | | - |
231 | 175 | /// <inheritdoc/> |
232 | 176 | SegmentInfo IPathInternals.PointAlongPath(float distance) |
233 | 177 | { |
|
0 commit comments