Bug 705200 - Add mozilla::gfx::Matrix::IsIdentity(). r=Bas

This commit is contained in:
Joe Drew 2012-01-04 18:02:59 -05:00
Родитель 6012344c54
Коммит 8d91c03a0b
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -156,6 +156,16 @@ public:
return false; return false;
} }
/* Returns true if the matrix is an identity matrix.
*/
bool IsIdentity() const
{
return _11 == 1.0f && _12 == 0.0f &&
_21 == 0.0f && _22 == 1.0f &&
_31 == 0.0f && _32 == 0.0f;
}
private: private:
static bool FuzzyEqual(Float aV1, Float aV2) { static bool FuzzyEqual(Float aV1, Float aV2) {
// XXX - Check if fabs does the smart thing and just negates the sign bit. // XXX - Check if fabs does the smart thing and just negates the sign bit.