зеркало из https://github.com/mozilla/gecko-dev.git
Bug 952977: More gfx::Matrix cleanup in nsDisplayTransform r=nical
This commit is contained in:
Родитель
ec6abc1e3e
Коммит
b967b647bf
|
@ -63,6 +63,8 @@ using namespace mozilla;
|
|||
using namespace mozilla::layers;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layout;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
typedef FrameMetrics::ViewID ViewID;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -4585,7 +4587,7 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp
|
|||
gfx3DMatrix result;
|
||||
// Call IsSVGTransformed() regardless of the value of
|
||||
// disp->mSpecifiedTransform, since we still need any transformFromSVGParent.
|
||||
mozilla::gfx::Matrix svgTransform, transformFromSVGParent;
|
||||
Matrix svgTransform, transformFromSVGParent;
|
||||
bool hasSVGTransforms =
|
||||
frame && frame->IsSVGTransformed(&svgTransform, &transformFromSVGParent);
|
||||
/* Transformed frames always have a transform, or are preserving 3d (and might still have perspective!) */
|
||||
|
@ -4757,7 +4759,7 @@ static bool IsFrameVisible(nsIFrame* aFrame, const gfx3DMatrix& aMatrix)
|
|||
return true;
|
||||
}
|
||||
|
||||
const gfx3DMatrix&
|
||||
const Matrix4x4&
|
||||
nsDisplayTransform::GetTransform()
|
||||
{
|
||||
if (mTransform.IsIdentity()) {
|
||||
|
@ -4768,7 +4770,7 @@ nsDisplayTransform::GetTransform()
|
|||
0.0f);
|
||||
if (mTransformGetter) {
|
||||
mTransform = mTransformGetter(mFrame, scale);
|
||||
mTransform.ChangeBasis(newOrigin);
|
||||
mTransform.ChangeBasis(newOrigin.x, newOrigin.y, newOrigin.z);
|
||||
} else {
|
||||
/**
|
||||
* Passing true as the final argument means that we want to shift the
|
||||
|
@ -4778,9 +4780,9 @@ nsDisplayTransform::GetTransform()
|
|||
* to be an ancestor of the preserve-3d chain, so we only need to do
|
||||
* this once.
|
||||
*/
|
||||
mTransform =
|
||||
mTransform = ToMatrix4x4(
|
||||
GetResultingTransformMatrix(mFrame, ToReferenceFrame(), scale,
|
||||
nullptr, nullptr, true);
|
||||
nullptr, nullptr, true));
|
||||
}
|
||||
}
|
||||
return mTransform;
|
||||
|
@ -4796,7 +4798,7 @@ already_AddRefed<Layer> nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu
|
|||
LayerManager *aManager,
|
||||
const ContainerLayerParameters& aContainerParameters)
|
||||
{
|
||||
const gfx3DMatrix& newTransformMatrix = GetTransform();
|
||||
const gfx3DMatrix& newTransformMatrix = To3DMatrix(GetTransform());
|
||||
|
||||
if (mFrame->StyleDisplay()->mBackfaceVisibility == NS_STYLE_BACKFACE_VISIBILITY_HIDDEN &&
|
||||
newTransformMatrix.IsBackfaceVisible()) {
|
||||
|
@ -4910,7 +4912,7 @@ void nsDisplayTransform::HitTest(nsDisplayListBuilder *aBuilder,
|
|||
*/
|
||||
// GetTransform always operates in dev pixels.
|
||||
float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
gfx3DMatrix matrix = GetTransform();
|
||||
gfx3DMatrix matrix = To3DMatrix(GetTransform());
|
||||
|
||||
if (!IsFrameVisible(mFrame, matrix)) {
|
||||
return;
|
||||
|
@ -4986,7 +4988,7 @@ nsDisplayTransform::GetHitDepthAtPoint(nsDisplayListBuilder* aBuilder, const nsP
|
|||
{
|
||||
// GetTransform always operates in dev pixels.
|
||||
float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
gfx3DMatrix matrix = GetTransform();
|
||||
gfx3DMatrix matrix = To3DMatrix(GetTransform());
|
||||
|
||||
NS_ASSERTION(IsFrameVisible(mFrame, matrix), "We can't have hit a frame that isn't visible!");
|
||||
|
||||
|
@ -5013,7 +5015,7 @@ nsRect nsDisplayTransform::GetBounds(nsDisplayListBuilder *aBuilder, bool* aSnap
|
|||
// GetTransform always operates in dev pixels.
|
||||
float factor = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
return nsLayoutUtils::MatrixTransformRect(untransformedBounds,
|
||||
GetTransform(),
|
||||
To3DMatrix(GetTransform()),
|
||||
factor);
|
||||
}
|
||||
|
||||
|
@ -5049,10 +5051,10 @@ nsRegion nsDisplayTransform::GetOpaqueRegion(nsDisplayListBuilder *aBuilder,
|
|||
return nsRegion();
|
||||
}
|
||||
|
||||
const gfx3DMatrix& matrix = GetTransform();
|
||||
const Matrix4x4& matrix = GetTransform();
|
||||
|
||||
nsRegion result;
|
||||
gfxMatrix matrix2d;
|
||||
Matrix matrix2d;
|
||||
bool tmpSnap;
|
||||
if (matrix.Is2D(&matrix2d) &&
|
||||
matrix2d.PreservesAxisAlignedRectangles() &&
|
||||
|
@ -5072,9 +5074,9 @@ bool nsDisplayTransform::IsUniform(nsDisplayListBuilder *aBuilder, nscolor* aCol
|
|||
if (!UntransformVisibleRect(aBuilder, &untransformedVisible)) {
|
||||
return false;
|
||||
}
|
||||
const gfx3DMatrix& matrix = GetTransform();
|
||||
const Matrix4x4& matrix = GetTransform();
|
||||
|
||||
gfxMatrix matrix2d;
|
||||
Matrix matrix2d;
|
||||
return matrix.Is2D(&matrix2d) &&
|
||||
matrix2d.PreservesAxisAlignedRectangles() &&
|
||||
mStoredList.GetVisibleRect().Contains(untransformedVisible) &&
|
||||
|
@ -5199,7 +5201,7 @@ bool nsDisplayTransform::UntransformRect(const nsRect &aTransformedBounds,
|
|||
bool nsDisplayTransform::UntransformVisibleRect(nsDisplayListBuilder* aBuilder,
|
||||
nsRect *aOutRect)
|
||||
{
|
||||
const gfx3DMatrix& matrix = GetTransform();
|
||||
const gfx3DMatrix& matrix = To3DMatrix(GetTransform());
|
||||
if (matrix.IsSingular())
|
||||
return false;
|
||||
|
||||
|
@ -5231,7 +5233,7 @@ void
|
|||
nsDisplayTransform::WriteDebugInfo(nsACString& aTo)
|
||||
{
|
||||
std::stringstream ss;
|
||||
AppendToString(ss, gfx::ToMatrix4x4(GetTransform()));
|
||||
AppendToString(ss, GetTransform());
|
||||
aTo += ss.str().c_str();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3157,6 +3157,7 @@ private:
|
|||
*/
|
||||
class nsDisplayTransform: public nsDisplayItem
|
||||
{
|
||||
typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
||||
public:
|
||||
/**
|
||||
* Returns a matrix (in pixels) for the current frame. The matrix should be relative to
|
||||
|
@ -3165,7 +3166,7 @@ public:
|
|||
* @param aFrame The frame to compute the transform for.
|
||||
* @param aAppUnitsPerPixel The number of app units per graphics unit.
|
||||
*/
|
||||
typedef gfx3DMatrix (* ComputeTransformFunction)(nsIFrame* aFrame, float aAppUnitsPerPixel);
|
||||
typedef Matrix4x4 (* ComputeTransformFunction)(nsIFrame* aFrame, float aAppUnitsPerPixel);
|
||||
|
||||
/* Constructor accepts a display list, empties it, and wraps it up. It also
|
||||
* ferries the underlying frame to the nsDisplayItem constructor.
|
||||
|
@ -3244,7 +3245,7 @@ public:
|
|||
INDEX_MAX = UINT32_MAX >> nsDisplayItem::TYPE_BITS
|
||||
};
|
||||
|
||||
const gfx3DMatrix& GetTransform();
|
||||
const Matrix4x4& GetTransform();
|
||||
|
||||
float GetHitDepthAtPoint(nsDisplayListBuilder* aBuilder, const nsPoint& aPoint);
|
||||
|
||||
|
@ -3383,7 +3384,7 @@ private:
|
|||
bool aOffsetByOrigin);
|
||||
|
||||
nsDisplayWrapList mStoredList;
|
||||
gfx3DMatrix mTransform;
|
||||
Matrix4x4 mTransform;
|
||||
ComputeTransformFunction mTransformGetter;
|
||||
nsRect mChildrenVisibleRect;
|
||||
uint32_t mIndex;
|
||||
|
|
|
@ -2416,7 +2416,7 @@ nsLayoutUtils::GetLayerTransformForFrame(nsIFrame* aFrame,
|
|||
new (&builder) nsDisplayTransform(&builder, aFrame, &list, nsRect());
|
||||
|
||||
*aTransform =
|
||||
item->GetTransform();
|
||||
To3DMatrix(item->GetTransform());
|
||||
item->~nsDisplayTransform();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -462,10 +462,10 @@ static void PaintHeaderFooter(nsIFrame* aFrame, nsRenderingContext* aCtx,
|
|||
static_cast<nsPageFrame*>(aFrame)->PaintHeaderFooter(*aCtx, aPt);
|
||||
}
|
||||
|
||||
static gfx3DMatrix ComputePageTransform(nsIFrame* aFrame, float aAppUnitsPerPixel)
|
||||
static gfx::Matrix4x4 ComputePageTransform(nsIFrame* aFrame, float aAppUnitsPerPixel)
|
||||
{
|
||||
float scale = aFrame->PresContext()->GetPageScale();
|
||||
return gfx3DMatrix::ScalingMatrix(scale, scale, 1);
|
||||
return gfx::Matrix4x4().Scale(scale, scale, 1);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
@ -766,11 +766,11 @@ nsSimplePageSequenceFrame::DoPageEnd()
|
|||
return rv;
|
||||
}
|
||||
|
||||
static gfx3DMatrix
|
||||
static gfx::Matrix4x4
|
||||
ComputePageSequenceTransform(nsIFrame* aFrame, float aAppUnitsPerPixel)
|
||||
{
|
||||
float scale = aFrame->PresContext()->GetPrintPreviewScale();
|
||||
return gfx3DMatrix::ScalingMatrix(scale, scale, 1);
|
||||
return gfx::Matrix4x4().Scale(scale, scale, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче