Bug 952977: More gfx::Matrix cleanups r=nical

This commit is contained in:
David Zbarsky 2014-08-01 08:31:49 -04:00
Родитель 14c6e4a712
Коммит b3e61c206f
19 изменённых файлов: 35 добавлений и 73 удалений

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

@ -3672,9 +3672,9 @@ nsDOMWindowUtils::GetOMTAStyle(nsIDOMElement* aElement,
MaybeTransform transform;
forwarder->GetShadowManager()->SendGetAnimationTransform(
layer->AsShadowableLayer()->GetShadow(), &transform);
if (transform.type() == MaybeTransform::Tgfx3DMatrix) {
cssValue =
nsComputedDOMStyle::MatrixToCSSValue(transform.get_gfx3DMatrix());
if (transform.type() == MaybeTransform::TMatrix4x4) {
gfx3DMatrix matrix = To3DMatrix(transform.get_Matrix4x4());
cssValue = nsComputedDOMStyle::MatrixToCSSValue(matrix);
}
}
}

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

@ -10,7 +10,6 @@
#include "GLTypes.h"
#include "nsRect.h"
#include "nsTArray.h"
#include "gfx3DMatrix.h"
namespace mozilla {
namespace gl {

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

@ -29,7 +29,6 @@
#include "GLDefs.h"
#include "GLLibraryLoader.h"
#include "gfx3DMatrix.h"
#include "nsISupportsImpl.h"
#include "plstr.h"
#include "nsDataHashtable.h"

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

@ -13,11 +13,11 @@
#include <stdint.h>
#include "gfx3DMatrix.h"
#include "gfxColor.h"
#include "mozilla/gfx/Matrix.h"
#include "GraphicsFilter.h"
#include "gfxPoint.h"
#include "gfxPoint3D.h"
#include "gfxRect.h"
#include "nsRect.h"
#include "nsRegion.h"
@ -217,32 +217,6 @@ struct ParamTraits<gfxRect>
}
};
template<>
struct ParamTraits<gfx3DMatrix>
{
typedef gfx3DMatrix paramType;
static void Write(Message* msg, const paramType& param)
{
#define Wr(_f) WriteParam(msg, param. _f)
Wr(_11); Wr(_12); Wr(_13); Wr(_14);
Wr(_21); Wr(_22); Wr(_23); Wr(_24);
Wr(_31); Wr(_32); Wr(_33); Wr(_34);
Wr(_41); Wr(_42); Wr(_43); Wr(_44);
#undef Wr
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
#define Rd(_f) ReadParam(msg, iter, &result-> _f)
return (Rd(_11) && Rd(_12) && Rd(_13) && Rd(_14) &&
Rd(_21) && Rd(_22) && Rd(_23) && Rd(_24) &&
Rd(_31) && Rd(_32) && Rd(_33) && Rd(_34) &&
Rd(_41) && Rd(_42) && Rd(_43) && Rd(_44));
#undef Rd
}
};
template <>
struct ParamTraits<gfxContentType>
: public ContiguousTypedEnumSerializer<

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

@ -7,7 +7,6 @@
#include "LayersLogging.h"
#include <stdint.h> // for uint8_t
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxColor.h" // for gfxRGBA
#include "mozilla/gfx/Matrix.h" // for Matrix4x4, Matrix
#include "nsDebug.h" // for NS_ERROR

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

@ -7,7 +7,6 @@
#include <sys/types.h> // for int32_t
#include "Layers.h" // for Layer, ThebesLayer, etc
#include "ReadbackLayer.h" // for ReadbackLayer, ReadbackSink
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxColor.h" // for gfxRGBA
#include "gfxContext.h" // for gfxContext
#include "gfxRect.h" // for gfxRect

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

@ -24,14 +24,14 @@ static gfx::Matrix4x4 GetRootTransform(Layer *aLayer) {
return layerTrans;
}
void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform, bool aReset) {
void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx::Matrix4x4 aRootTransform, bool aReset) {
if (!aLayer)
return;
gfx3DMatrix trans = aRootTransform * aLayer->GetTransform();
gfx::Matrix4x4 trans = aRootTransform * aLayer->GetTransform();
trans.ProjectTo2D();
nsIntRect clipRect = aLayer->GetEffectiveVisibleRegion().GetBounds();
gfxRect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
Rect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
trans.TransformBounds(rect);
if (strcmp(aLayer->Name(), "ContainerLayer") != 0 &&

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

@ -15,15 +15,15 @@
#ifndef GFX_RENDERTRACE_H
#define GFX_RENDERTRACE_H
#include "gfx3DMatrix.h"
#include "nsRect.h"
#include "mozilla/gfx/Matrix.h"
namespace mozilla {
namespace layers {
class Layer;
void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform = gfx3DMatrix(), bool aReset = true);
void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx::Matrix4x4 aRootTransform = gfx::Matrix4x4(), bool aReset = true);
void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect);
void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor);
@ -49,7 +49,7 @@ private:
};
#ifndef MOZ_RENDERTRACE
inline void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform, bool aReset)
inline void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx::Matrix4x4 aRootTransform, bool aReset)
{}
inline void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect)

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

@ -7,7 +7,6 @@
#include "Units.h" // for ScreenIntRect, CSSPoint, etc
#include "UnitTransforms.h" // for TransformTo
#include "ClientLayerManager.h" // for ClientLayerManager, etc
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxPlatform.h" // for gfxPlatform
#include "gfxPrefs.h" // for gfxPrefs
#include "gfxRect.h" // for gfxRect

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

@ -1126,30 +1126,31 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
*/
static LayerRect
GetCompositorSideCompositionBounds(ContainerLayer* aScrollAncestor,
const gfx3DMatrix& aTransformToCompBounds,
const Matrix4x4& aTransformToCompBounds,
const ViewTransform& aAPZTransform)
{
gfx3DMatrix nonTransientAPZTransform = gfx3DMatrix::ScalingMatrix(
Matrix4x4 nonTransientAPZUntransform = Matrix4x4().Scale(
aScrollAncestor->GetFrameMetrics().mResolution.scale,
aScrollAncestor->GetFrameMetrics().mResolution.scale,
1.f);
nonTransientAPZUntransform.Invert();
gfx3DMatrix layerTransform = gfx::To3DMatrix(aScrollAncestor->GetTransform());
Matrix4x4 layerTransform = aScrollAncestor->GetTransform();
Matrix4x4 layerUntransform = layerTransform;
layerUntransform.Invert();
// First take off the last two "terms" of aTransformToCompBounds, which
// are the scroll ancestor's local transform and the APZ's nontransient async
// transform.
gfx3DMatrix transform = aTransformToCompBounds;
transform = transform * layerTransform.Inverse();
transform = transform * nonTransientAPZTransform.Inverse();
Matrix4x4 transform = aTransformToCompBounds * layerUntransform * nonTransientAPZUntransform;
// Next, apply the APZ's async transform (this includes the nontransient component
// as well).
transform = transform * To3DMatrix(aAPZTransform);
transform = transform * Matrix4x4(aAPZTransform);
// Finally, put back the scroll ancestor's local transform.
transform = transform * layerTransform;
return TransformTo<LayerPixel>(transform.Inverse(),
return TransformTo<LayerPixel>(To3DMatrix(transform).Inverse(),
aScrollAncestor->GetFrameMetrics().mCompositionBounds);
}
@ -1228,7 +1229,7 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
LayerRect transformedCompositionBounds =
GetCompositorSideCompositionBounds(scrollAncestor,
To3DMatrix(aPaintData->mTransformToCompBounds),
aPaintData->mTransformToCompBounds,
viewTransform);
TILING_LOG("TILING %p: Progressive update transformed compositor bounds %s\n", mThebesLayer, Stringify(transformedCompositionBounds).c_str());

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

@ -675,9 +675,11 @@ ApplyAsyncTransformToScrollbarForContent(TimeStamp aCurrentFrame, ContainerLayer
apzc->SampleContentTransformForFrame(aCurrentFrame, &asyncTransform, scrollOffset);
}
gfx3DMatrix asyncTransform = To3DMatrix(apzc->GetCurrentAsyncTransform());
gfx3DMatrix nontransientTransform = To3DMatrix(apzc->GetNontransientAsyncTransform());
gfx3DMatrix transientTransform = asyncTransform * nontransientTransform.Inverse();
Matrix4x4 asyncTransform = apzc->GetCurrentAsyncTransform();
Matrix4x4 nontransientTransform = apzc->GetNontransientAsyncTransform();
Matrix4x4 nontransientUntransform = nontransientTransform;
nontransientUntransform.Invert();
Matrix4x4 transientTransform = asyncTransform * nontransientUntransform;
// |transientTransform| represents the amount by which we have scrolled and
// zoomed since the last paint. Because the scrollbar was sized and positioned based
@ -695,12 +697,12 @@ ApplyAsyncTransformToScrollbarForContent(TimeStamp aCurrentFrame, ContainerLayer
Matrix4x4 scrollbarTransform;
if (aScrollbar->GetScrollbarDirection() == Layer::VERTICAL) {
float scale = metrics.CalculateCompositedSizeInCssPixels().height / metrics.mScrollableRect.height;
scrollbarTransform = scrollbarTransform * Matrix4x4().Scale(1.f, 1.f / transientTransform.GetYScale(), 1.f);
scrollbarTransform = scrollbarTransform * Matrix4x4().Scale(1.f, 1.f / transientTransform._22, 1.f);
scrollbarTransform = scrollbarTransform * Matrix4x4().Translate(0, -transientTransform._42 * scale, 0);
}
if (aScrollbar->GetScrollbarDirection() == Layer::HORIZONTAL) {
float scale = metrics.CalculateCompositedSizeInCssPixels().width / metrics.mScrollableRect.width;
scrollbarTransform = scrollbarTransform * Matrix4x4().Scale(1.f / transientTransform.GetXScale(), 1.f, 1.f);
scrollbarTransform = scrollbarTransform * Matrix4x4().Scale(1.f / transientTransform._11, 1.f, 1.f);
scrollbarTransform = scrollbarTransform * Matrix4x4().Translate(-transientTransform._41 * scale, 0, 0);
}
@ -712,7 +714,8 @@ ApplyAsyncTransformToScrollbarForContent(TimeStamp aCurrentFrame, ContainerLayer
// the content. This is needed because otherwise that transient async transform is
// part of the effective transform of this scrollbar, and the scrollbar will jitter
// as the content scrolls.
transform = transform * ToMatrix4x4(transientTransform.Inverse());
transientTransform.Invert();
transform = transform * transientTransform;
}
// GetTransform already takes the pre- and post-scale into account. Since we

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

@ -8,7 +8,6 @@
#include "FrameMetrics.h" // for FrameMetrics
#include "Units.h" // for LayerRect, LayerPixel, etc
#include "gfx2DGlue.h" // for ToMatrix4x4
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxPrefs.h" // for gfxPrefs
#include "gfxUtils.h" // for gfxUtils, etc
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc

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

@ -11,7 +11,6 @@
#include "ImageLayers.h" // for ImageLayer
#include "Layers.h" // for Layer, ContainerLayer, etc
#include "ShadowLayerParent.h" // for ShadowLayerParent
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxPoint3D.h" // for gfxPoint3D
#include "CompositableTransactionParent.h" // for EditReplyVector
#include "ShadowLayersManager.h" // for ShadowLayersManager
@ -631,7 +630,7 @@ LayerTransactionParent::RecvGetAnimationTransform(PLayerParent* aParent,
// from the shadow transform by undoing the translations in
// AsyncCompositionManager::SampleValue.
gfx3DMatrix transform = gfx::To3DMatrix(layer->AsLayerComposite()->GetShadowTransform());
Matrix4x4 transform = layer->AsLayerComposite()->GetShadowTransform();
if (ContainerLayer* c = layer->AsContainerLayer()) {
// Undo the scale transform applied by AsyncCompositionManager::SampleValue
transform.ScalePost(1.0f/c->GetInheritedXScale(),
@ -658,11 +657,12 @@ LayerTransactionParent::RecvGetAnimationTransform(PLayerParent* aParent,
// Undo the translation to the origin of the reference frame applied by
// AsyncCompositionManager::SampleValue
transform.Translate(-scaledOrigin);
transform.Translate(-scaledOrigin.x, -scaledOrigin.y, -scaledOrigin.z);
// Undo the rebasing applied by
// nsDisplayTransform::GetResultingTransformMatrixInternal
transform.ChangeBasis(-scaledOrigin - transformOrigin);
gfxPoint3D basis = -scaledOrigin - transformOrigin;
transform.ChangeBasis(basis.x, basis.y, basis.z);
// Convert to CSS pixels (this undoes the operations performed by
// nsStyleTransformMatrix::ProcessTranslatePart which is called from

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

@ -17,8 +17,6 @@
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
class gfx3DMatrix;
namespace mozilla {
namespace ipc {

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

@ -20,7 +20,6 @@ using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
using struct gfxRGBA from "gfxColor.h";
using struct gfxPoint3D from "gfxPoint3D.h";
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
using class gfx3DMatrix from "gfx3DMatrix.h";
using nscoord from "nsCoord.h";
using struct nsIntPoint from "nsPoint.h";
using struct nsRect from "nsRect.h";
@ -151,7 +150,7 @@ struct AnimationSegment {
};
// Transforms need extra information to correctly convert the list of transform
// functions to a gfx3DMatrix that can be applied directly to the layer.
// functions to a Matrix4x4 that can be applied directly to the layer.
struct TransformData {
// the origin of the frame being transformed in app units
nsPoint origin;

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

@ -32,7 +32,7 @@ namespace mozilla {
namespace layers {
union MaybeTransform {
gfx3DMatrix;
Matrix4x4;
void_t;
};

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

@ -13,7 +13,6 @@
#include "Layers.h" // for WriteSnapshotToDumpFile
#include "LayerScope.h" // for LayerScope
#include "gfx2DGlue.h" // for ThebesFilter
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxCrashReporterUtils.h" // for ScopedGfxFeatureReporter
#include "GraphicsFilter.h" // for GraphicsFilter
#include "gfxPlatform.h" // for gfxPlatform

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

@ -35,7 +35,6 @@
#include <ui/GraphicBuffer.h>
#endif
class gfx3DMatrix;
class nsIWidget;
namespace mozilla {

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

@ -7,7 +7,6 @@
#define GFX_OGLSHADERPROGRAM_H
#include "GLContext.h" // for fast inlines of glUniform*
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxTypes.h"
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/RefPtr.h" // for RefPtr
@ -471,10 +470,6 @@ protected:
}
}
void SetMatrixUniform(KnownUniform::KnownUniformName aKnownUniform, const gfx3DMatrix& aMatrix) {
SetMatrixUniform(aKnownUniform, &aMatrix._11);
}
void SetMatrixUniform(KnownUniform::KnownUniformName aKnownUniform, const gfx::Matrix4x4& aMatrix) {
SetMatrixUniform(aKnownUniform, &aMatrix._11);
}