Bug 1352564 - Add a method to invert a Matrix4x4 if it's invertible. r=botond

Use it in HitTestingTreeNode::Untransform.

MozReview-Commit-ID: 1JkLh99FD0h

--HG--
extra : rebase_source : ca9836c1999a2af3cac5287a9efa875c415634f7
This commit is contained in:
Botond Ballo 2017-04-02 17:20:23 -04:00
parent 8a81f4a587
commit 9ebdb4f7f0
2 changed files with 15 additions and 1 deletions

View File

@ -1236,6 +1236,16 @@ public:
return clone;
}
Maybe<Matrix4x4Typed<TargetUnits, SourceUnits>> MaybeInverse() const
{
typedef Matrix4x4Typed<TargetUnits, SourceUnits> InvertedMatrix;
InvertedMatrix clone = InvertedMatrix::FromUnknownMatrix(ToUnknownMatrix());
if (clone.Invert()) {
return Some(clone);
}
return Nothing();
}
void Normalize()
{
for (int i = 0; i < 4; i++) {

View File

@ -255,7 +255,11 @@ HitTestingTreeNode::Untransform(const ParentLayerPoint& aPoint) const
mApzc
? mApzc->GetCurrentAsyncTransformWithOverscroll(AsyncPanZoomController::NORMAL)
: AsyncTransformComponentMatrix());
return UntransformBy(transform.Inverse(), aPoint);
Maybe<ParentLayerToLayerMatrix4x4> inverse = transform.MaybeInverse();
if (inverse) {
return UntransformBy(inverse.ref(), aPoint);
}
return Nothing();
}
HitTestResult