@@ -12,7 +12,6 @@ namespace SixLabors.ImageSharp.Processing;
1212public class AffineTransformBuilder
1313{
1414 private readonly List < Func < Size , Matrix3x2 > > transformMatrixFactories = new ( ) ;
15- private readonly List < Func < Size , Matrix3x2 > > boundsMatrixFactories = new ( ) ;
1615
1716 /// <summary>
1817 /// Prepends a rotation matrix using the given rotation angle in degrees
@@ -31,8 +30,7 @@ public AffineTransformBuilder PrependRotationDegrees(float degrees)
3130 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
3231 public AffineTransformBuilder PrependRotationRadians ( float radians )
3332 => this . Prepend (
34- size => TransformUtils . CreateRotationTransformMatrixRadians ( radians , size ) ,
35- size => TransformUtils . CreateRotationBoundsMatrixRadians ( radians , size ) ) ;
33+ size => TransformUtils . CreateRotationTransformMatrixRadians ( radians , size ) ) ;
3634
3735 /// <summary>
3836 /// Prepends a rotation matrix using the given rotation in degrees at the given origin.
@@ -68,9 +66,7 @@ public AffineTransformBuilder AppendRotationDegrees(float degrees)
6866 /// <param name="radians">The amount of rotation, in radians.</param>
6967 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
7068 public AffineTransformBuilder AppendRotationRadians ( float radians )
71- => this . Append (
72- size => TransformUtils . CreateRotationTransformMatrixRadians ( radians , size ) ,
73- size => TransformUtils . CreateRotationBoundsMatrixRadians ( radians , size ) ) ;
69+ => this . Append ( size => TransformUtils . CreateRotationTransformMatrixRadians ( radians , size ) ) ;
7470
7571 /// <summary>
7672 /// Appends a rotation matrix using the given rotation in degrees at the given origin.
@@ -145,9 +141,7 @@ public AffineTransformBuilder AppendScale(Vector2 scales)
145141 /// <param name="degreesY">The Y angle, in degrees.</param>
146142 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
147143 public AffineTransformBuilder PrependSkewDegrees ( float degreesX , float degreesY )
148- => this . Prepend (
149- size => TransformUtils . CreateSkewTransformMatrixDegrees ( degreesX , degreesY , size ) ,
150- size => TransformUtils . CreateSkewBoundsMatrixDegrees ( degreesX , degreesY , size ) ) ;
144+ => this . Prepend ( size => TransformUtils . CreateSkewTransformMatrixDegrees ( degreesX , degreesY , size ) ) ;
151145
152146 /// <summary>
153147 /// Prepends a centered skew matrix from the give angles in radians.
@@ -156,9 +150,7 @@ public AffineTransformBuilder PrependSkewDegrees(float degreesX, float degreesY)
156150 /// <param name="radiansY">The Y angle, in radians.</param>
157151 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
158152 public AffineTransformBuilder PrependSkewRadians ( float radiansX , float radiansY )
159- => this . Prepend (
160- size => TransformUtils . CreateSkewTransformMatrixRadians ( radiansX , radiansY , size ) ,
161- size => TransformUtils . CreateSkewBoundsMatrixRadians ( radiansX , radiansY , size ) ) ;
153+ => this . Prepend ( size => TransformUtils . CreateSkewTransformMatrixRadians ( radiansX , radiansY , size ) ) ;
162154
163155 /// <summary>
164156 /// Prepends a skew matrix using the given angles in degrees at the given origin.
@@ -187,9 +179,7 @@ public AffineTransformBuilder PrependSkewRadians(float radiansX, float radiansY,
187179 /// <param name="degreesY">The Y angle, in degrees.</param>
188180 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
189181 public AffineTransformBuilder AppendSkewDegrees ( float degreesX , float degreesY )
190- => this . Append (
191- size => TransformUtils . CreateSkewTransformMatrixDegrees ( degreesX , degreesY , size ) ,
192- size => TransformUtils . CreateSkewBoundsMatrixDegrees ( degreesX , degreesY , size ) ) ;
182+ => this . Append ( size => TransformUtils . CreateSkewTransformMatrixDegrees ( degreesX , degreesY , size ) ) ;
193183
194184 /// <summary>
195185 /// Appends a centered skew matrix from the give angles in radians.
@@ -198,9 +188,7 @@ public AffineTransformBuilder AppendSkewDegrees(float degreesX, float degreesY)
198188 /// <param name="radiansY">The Y angle, in radians.</param>
199189 /// <returns>The <see cref="AffineTransformBuilder"/>.</returns>
200190 public AffineTransformBuilder AppendSkewRadians ( float radiansX , float radiansY )
201- => this . Append (
202- size => TransformUtils . CreateSkewTransformMatrixRadians ( radiansX , radiansY , size ) ,
203- size => TransformUtils . CreateSkewBoundsMatrixRadians ( radiansX , radiansY , size ) ) ;
191+ => this . Append ( size => TransformUtils . CreateSkewTransformMatrixRadians ( radiansX , radiansY , size ) ) ;
204192
205193 /// <summary>
206194 /// Appends a skew matrix using the given angles in degrees at the given origin.
@@ -267,7 +255,7 @@ public AffineTransformBuilder AppendTranslation(Vector2 position)
267255 public AffineTransformBuilder PrependMatrix ( Matrix3x2 matrix )
268256 {
269257 CheckDegenerate ( matrix ) ;
270- return this . Prepend ( _ => matrix , _ => matrix ) ;
258+ return this . Prepend ( _ => matrix ) ;
271259 }
272260
273261 /// <summary>
@@ -283,7 +271,7 @@ public AffineTransformBuilder PrependMatrix(Matrix3x2 matrix)
283271 public AffineTransformBuilder AppendMatrix ( Matrix3x2 matrix )
284272 {
285273 CheckDegenerate ( matrix ) ;
286- return this . Append ( _ => matrix , _ => matrix ) ;
274+ return this . Append ( _ => matrix ) ;
287275 }
288276
289277 /// <summary>
@@ -340,13 +328,13 @@ public Size GetTransformedSize(Rectangle sourceRectangle)
340328 // Translate the origin matrix to cater for source rectangle offsets.
341329 Matrix3x2 matrix = Matrix3x2 . CreateTranslation ( - sourceRectangle . Location ) ;
342330
343- foreach ( Func < Size , Matrix3x2 > factory in this . boundsMatrixFactories )
331+ foreach ( Func < Size , Matrix3x2 > factory in this . transformMatrixFactories )
344332 {
345333 matrix *= factory ( size ) ;
346334 CheckDegenerate ( matrix ) ;
347335 }
348336
349- return TransformUtils . GetTransformedSize ( size , matrix ) ;
337+ return TransformUtils . GetTransformedSize ( matrix , size ) ;
350338 }
351339
352340 private static void CheckDegenerate ( Matrix3x2 matrix )
@@ -357,17 +345,15 @@ private static void CheckDegenerate(Matrix3x2 matrix)
357345 }
358346 }
359347
360- private AffineTransformBuilder Prepend ( Func < Size , Matrix3x2 > transformFactory , Func < Size , Matrix3x2 > boundsFactory )
348+ private AffineTransformBuilder Prepend ( Func < Size , Matrix3x2 > transformFactory )
361349 {
362350 this . transformMatrixFactories . Insert ( 0 , transformFactory ) ;
363- this . boundsMatrixFactories . Insert ( 0 , boundsFactory ) ;
364351 return this ;
365352 }
366353
367- private AffineTransformBuilder Append ( Func < Size , Matrix3x2 > transformFactory , Func < Size , Matrix3x2 > boundsFactory )
354+ private AffineTransformBuilder Append ( Func < Size , Matrix3x2 > transformFactory )
368355 {
369356 this . transformMatrixFactories . Add ( transformFactory ) ;
370- this . boundsMatrixFactories . Add ( boundsFactory ) ;
371357 return this ;
372358 }
373359}
0 commit comments