Browse Source

Merge pull request #2196 from jp2masa/matrix-optimization

Removed duplicate call to GetDeterminant
Jumar Macato 7 years ago
parent
commit
7c9c79e455
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/Avalonia.Visuals/Matrix.cs

+ 3 - 3
src/Avalonia.Visuals/Matrix.cs

@@ -293,13 +293,13 @@ namespace Avalonia
         /// <returns>The inverted matrix.</returns>
         public Matrix Invert()
         {
-            if (GetDeterminant() == 0)
+            double d = GetDeterminant();
+
+            if (d == 0)
             {
                 throw new InvalidOperationException("Transform is not invertible.");
             }
 
-            double d = GetDeterminant();
-
             return new Matrix(
                 _m22 / d,
                 -_m12 / d,