Browse Source
Merge pull request #2196 from jp2masa/matrix-optimization
Removed duplicate call to GetDeterminant
pull/2201/head
Jumar Macato
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
3 deletions
-
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, |
|
|
|
|