mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 952977: More gfx::Matrix cleanup in AsyncCompositionManager r=nical
This commit is contained in:
parent
d67b83d96e
commit
e58cb94cdf
@ -556,6 +556,25 @@ public:
|
||||
|
||||
bool Invert();
|
||||
|
||||
void ScalePost(Float aX, Float aY, Float aZ)
|
||||
{
|
||||
_11 *= aX;
|
||||
_21 *= aX;
|
||||
_31 *= aX;
|
||||
_41 *= aX;
|
||||
|
||||
_12 *= aY;
|
||||
_22 *= aY;
|
||||
_32 *= aY;
|
||||
_42 *= aY;
|
||||
|
||||
_13 *= aZ;
|
||||
_23 *= aZ;
|
||||
_33 *= aZ;
|
||||
_43 *= aZ;
|
||||
}
|
||||
|
||||
|
||||
// Set all the members of the matrix to NaN
|
||||
void SetNAN();
|
||||
};
|
||||
|
@ -1196,7 +1196,7 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc,
|
||||
// and RC.Inverse() * QC.Inverse() * PC.Inverse() * PA.Inverse() at P.
|
||||
gfx3DMatrix childUntransform = ancestorUntransform
|
||||
* aApzc->GetCSSTransform().Inverse()
|
||||
* gfx3DMatrix(aApzc->GetCurrentAsyncTransform()).Inverse();
|
||||
* gfx::To3DMatrix(aApzc->GetCurrentAsyncTransform()).Inverse();
|
||||
gfxPointH3D hitTestPointForChildLayers = childUntransform.ProjectPoint(aHitTestPoint);
|
||||
APZCTM_LOG("Untransformed %f %f to layer coordinates %f %f for APZC %p\n",
|
||||
aHitTestPoint.x, aHitTestPoint.y,
|
||||
@ -1344,7 +1344,7 @@ APZCTreeManager::GetInputTransforms(AsyncPanZoomController *aApzc, gfx3DMatrix&
|
||||
// ancestorUntransform is OC.Inverse() * NC.Inverse() * MC.Inverse()
|
||||
gfx3DMatrix ancestorUntransform = aApzc->GetAncestorTransform().Inverse();
|
||||
// asyncUntransform is LA.Inverse()
|
||||
gfx3DMatrix asyncUntransform = gfx3DMatrix(aApzc->GetCurrentAsyncTransform()).Inverse();
|
||||
gfx3DMatrix asyncUntransform = gfx::To3DMatrix(aApzc->GetCurrentAsyncTransform()).Inverse();
|
||||
// nontransientAsyncTransform is LN
|
||||
gfx3DMatrix nontransientAsyncTransform = aApzc->GetNontransientAsyncTransform();
|
||||
// transientAsyncUntransform is LT.Inverse()
|
||||
@ -1359,7 +1359,7 @@ APZCTreeManager::GetInputTransforms(AsyncPanZoomController *aApzc, gfx3DMatrix&
|
||||
// ancestorUntransform is updated to RC.Inverse() * QC.Inverse() when parent == P
|
||||
ancestorUntransform = parent->GetAncestorTransform().Inverse();
|
||||
// asyncUntransform is updated to PA.Inverse() when parent == P
|
||||
asyncUntransform = gfx3DMatrix(parent->GetCurrentAsyncTransform()).Inverse();
|
||||
asyncUntransform = gfx::To3DMatrix(parent->GetCurrentAsyncTransform()).Inverse();
|
||||
// untransformSinceLastApzc is RC.Inverse() * QC.Inverse() * PC.Inverse() * PA.Inverse()
|
||||
gfx3DMatrix untransformSinceLastApzc = ancestorUntransform * parent->GetCSSTransform().Inverse() * asyncUntransform;
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ GetCompositorSideCompositionBounds(ContainerLayer* aScrollAncestor,
|
||||
|
||||
// Next, apply the APZ's async transform (this includes the nontransient component
|
||||
// as well).
|
||||
transform = transform * gfx3DMatrix(aAPZTransform);
|
||||
transform = transform * To3DMatrix(aAPZTransform);
|
||||
|
||||
// Finally, put back the scroll ancestor's local transform.
|
||||
transform = transform * layerTransform;
|
||||
|
@ -509,9 +509,9 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
|
||||
}
|
||||
|
||||
Matrix4x4
|
||||
AdjustAndCombineWithCSSTransform(const gfx3DMatrix& asyncTransform, Layer* aLayer)
|
||||
AdjustAndCombineWithCSSTransform(const Matrix4x4& asyncTransform, Layer* aLayer)
|
||||
{
|
||||
Matrix4x4 result = ToMatrix4x4(asyncTransform);
|
||||
Matrix4x4 result = asyncTransform;
|
||||
|
||||
// Container layers start at the origin, but they are clipped to where they
|
||||
// actually have content on the screen. The tree transform is meant to apply
|
||||
@ -675,7 +675,7 @@ ApplyAsyncTransformToScrollbarForContent(TimeStamp aCurrentFrame, ContainerLayer
|
||||
apzc->SampleContentTransformForFrame(aCurrentFrame, &asyncTransform, scrollOffset);
|
||||
}
|
||||
|
||||
gfx3DMatrix asyncTransform = gfx3DMatrix(apzc->GetCurrentAsyncTransform());
|
||||
gfx3DMatrix asyncTransform = To3DMatrix(apzc->GetCurrentAsyncTransform());
|
||||
gfx3DMatrix nontransientTransform = apzc->GetNontransientAsyncTransform();
|
||||
gfx3DMatrix transientTransform = asyncTransform * nontransientTransform.Inverse();
|
||||
|
||||
@ -780,11 +780,8 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
const FrameMetrics& metrics = container->GetFrameMetrics();
|
||||
// We must apply the resolution scale before a pan/zoom transform, so we call
|
||||
// GetTransform here.
|
||||
gfx3DMatrix currentTransform = To3DMatrix(aLayer->GetTransform());
|
||||
Matrix4x4 oldTransform = aLayer->GetTransform();
|
||||
|
||||
gfx3DMatrix treeTransform;
|
||||
|
||||
CSSToLayerScale geckoZoom = metrics.LayersPixelsPerCSSPixel();
|
||||
|
||||
LayerIntPoint scrollOffsetLayerPixels = RoundedToInt(metrics.GetScrollOffset() * geckoZoom);
|
||||
@ -842,22 +839,22 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
}
|
||||
|
||||
LayerPoint translation = (userScroll / zoomAdjust) - geckoScroll;
|
||||
treeTransform = gfx3DMatrix(ViewTransform(-translation,
|
||||
Matrix4x4 treeTransform = ViewTransform(-translation,
|
||||
userZoom
|
||||
/ metrics.mDevPixelsPerCSSPixel
|
||||
/ metrics.GetParentResolution()));
|
||||
/ metrics.GetParentResolution());
|
||||
|
||||
// The transform already takes the resolution scale into account. Since we
|
||||
// will apply the resolution scale again when computing the effective
|
||||
// transform, we must apply the inverse resolution scale here.
|
||||
gfx3DMatrix computedTransform = treeTransform * currentTransform;
|
||||
Matrix4x4 computedTransform = treeTransform * oldTransform;
|
||||
computedTransform.Scale(1.0f/container->GetPreXScale(),
|
||||
1.0f/container->GetPreYScale(),
|
||||
1);
|
||||
computedTransform.ScalePost(1.0f/container->GetPostXScale(),
|
||||
1.0f/container->GetPostYScale(),
|
||||
1);
|
||||
layerComposite->SetShadowTransform(ToMatrix4x4(computedTransform));
|
||||
layerComposite->SetShadowTransform(computedTransform);
|
||||
NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(),
|
||||
"overwriting animated transform!");
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
|
||||
#include "Units.h" // for LayerPoint, etc
|
||||
#include "mozilla/layers/LayerManagerComposite.h" // for LayerManagerComposite
|
||||
#include "gfx3DMatrix.h" // for gfx3DMatrix
|
||||
#include "mozilla/Attributes.h" // for MOZ_DELETE, MOZ_FINAL, etc
|
||||
#include "mozilla/RefPtr.h" // for RefCounted
|
||||
#include "mozilla/TimeStamp.h" // for TimeStamp
|
||||
#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
|
||||
#include "mozilla/gfx/BasePoint.h" // for BasePoint
|
||||
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
||||
#include "mozilla/layers/LayersMessages.h" // for TargetConfig
|
||||
#include "nsAutoPtr.h" // for nsRefPtr
|
||||
#include "nsISupportsImpl.h" // for LayerManager::AddRef, etc
|
||||
@ -34,17 +34,17 @@ struct ViewTransform {
|
||||
, mScale(aScale)
|
||||
{}
|
||||
|
||||
operator gfx3DMatrix() const
|
||||
operator gfx::Matrix4x4() const
|
||||
{
|
||||
return
|
||||
gfx3DMatrix::Translation(mTranslation.x, mTranslation.y, 0) *
|
||||
gfx3DMatrix::ScalingMatrix(mScale.scale, mScale.scale, 1);
|
||||
gfx::Matrix4x4().Translate(mTranslation.x, mTranslation.y, 0) *
|
||||
gfx::Matrix4x4().Scale(mScale.scale, mScale.scale, 1);
|
||||
}
|
||||
|
||||
// For convenience, to avoid writing the cumbersome
|
||||
// "gfx3dMatrix(a) * gfx3DMatrix(b)".
|
||||
friend gfx3DMatrix operator*(const ViewTransform& a, const ViewTransform& b) {
|
||||
return gfx3DMatrix(a) * gfx3DMatrix(b);
|
||||
// "gfx::Matrix4x4(a) * gfx::Matrix4x4(b)".
|
||||
friend gfx::Matrix4x4 operator*(const ViewTransform& a, const ViewTransform& b) {
|
||||
return gfx::Matrix4x4(a) * gfx::Matrix4x4(b);
|
||||
}
|
||||
|
||||
bool operator==(const ViewTransform& rhs) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user