mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1074944 - Add Inverse functions on Matrix and Matrix4x4. r=Bas
This commit is contained in:
parent
e3e7c8f2fb
commit
ab1a3f24c5
@ -11,6 +11,7 @@
|
|||||||
#include "Point.h"
|
#include "Point.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "mozilla/DebugOnly.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
@ -186,6 +187,14 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Matrix Inverse() const
|
||||||
|
{
|
||||||
|
Matrix clone = *this;
|
||||||
|
DebugOnly<bool> inverted = clone.Invert();
|
||||||
|
MOZ_ASSERT(inverted, "Attempted to get the inverse of a non-invertible matrix");
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
Float Determinant() const
|
Float Determinant() const
|
||||||
{
|
{
|
||||||
return _11 * _22 - _12 * _21;
|
return _11 * _22 - _12 * _21;
|
||||||
@ -671,6 +680,14 @@ public:
|
|||||||
|
|
||||||
bool Invert();
|
bool Invert();
|
||||||
|
|
||||||
|
Matrix4x4 Inverse() const
|
||||||
|
{
|
||||||
|
Matrix4x4 clone = *this;
|
||||||
|
DebugOnly<bool> inverted = clone.Invert();
|
||||||
|
MOZ_ASSERT(inverted, "Attempted to get the inverse of a non-invertible matrix");
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
void Normalize()
|
void Normalize()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user