Browse Source

Merge pull request #2913 from MarchingCube/rect-aabb-allocations

Get rid of allocations in Rect.TransformToAABB
Jumar Macato 6 years ago
parent
commit
3b38aea2b9
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Avalonia.Visuals/Rect.cs

+ 2 - 2
src/Avalonia.Visuals/Rect.cs

@@ -371,12 +371,12 @@ namespace Avalonia
         /// <returns>The bounding box</returns>
         public Rect TransformToAABB(Matrix matrix)
         {
-            var points = new[]
+            ReadOnlySpan<Point> points = stackalloc Point[4]
             {
                 TopLeft.Transform(matrix),
                 TopRight.Transform(matrix),
                 BottomRight.Transform(matrix),
-                BottomLeft.Transform(matrix),
+                BottomLeft.Transform(matrix)
             };
 
             var left = double.MaxValue;