11// Copyright (c) Six Labors.
22// Licensed under the Six Labors Split License.
33
4- using System . Numerics ;
5-
64namespace SixLabors . ImageSharp . Drawing . Shapes . PolygonClipper ;
75
86/// <summary>
97/// Wrapper for clipper offset
108/// </summary>
119internal class ClipperOffset
1210{
13- // To make the floating point polygons compatible with clipper we have to scale them.
14- private const float ScalingFactor = 1000F ;
1511 private readonly PolygonOffsetter polygonClipperOffset ;
1612
1713 /// <summary>
@@ -30,16 +26,16 @@ public ClipperOffset(float meterLimit = 2F, float arcTolerance = .25F)
3026 public ComplexPolygon Execute ( float width )
3127 {
3228 PathsF solution = new ( ) ;
33- this . polygonClipperOffset . Execute ( width * ScalingFactor , solution ) ;
29+ this . polygonClipperOffset . Execute ( width , solution ) ;
3430
35- var polygons = new Polygon [ solution . Count ] ;
31+ Polygon [ ] polygons = new Polygon [ solution . Count ] ;
3632 for ( int i = 0 ; i < solution . Count ; i ++ )
3733 {
3834 PathF pt = solution [ i ] ;
39- var points = new PointF [ pt . Count ] ;
35+ PointF [ ] points = new PointF [ pt . Count ] ;
4036 for ( int j = 0 ; j < pt . Count ; j ++ )
4137 {
42- points [ j ] = pt [ j ] / ScalingFactor ;
38+ points [ j ] = pt [ j ] ;
4339 }
4440
4541 polygons [ i ] = new Polygon ( points ) ;
@@ -59,7 +55,7 @@ public void AddPath(ReadOnlySpan<PointF> pathPoints, JointStyle jointStyle, EndC
5955 PathF points = new ( pathPoints . Length ) ;
6056 for ( int i = 0 ; i < pathPoints . Length ; i ++ )
6157 {
62- points . Add ( ( Vector2 ) pathPoints [ i ] * ScalingFactor ) ;
58+ points . Add ( pathPoints [ i ] ) ;
6359 }
6460
6561 this . polygonClipperOffset . AddPath ( points , jointStyle , endCapStyle ) ;
0 commit comments