зеркало из https://github.com/mozilla/gecko-dev.git
Bug 952977: Convert SetBaseTransform to gfx::Matrix4x4 r=nical
This commit is contained in:
Родитель
9288df6e4d
Коммит
bab894b2de
|
@ -346,6 +346,16 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Matrix4x4 &Translate(Float aX, Float aY, Float aZ)
|
||||||
|
{
|
||||||
|
_41 += aX * _11 + aY * _21 + aZ * _31;
|
||||||
|
_42 += aX * _12 + aY * _22 + aZ * _32;
|
||||||
|
_43 += aX * _13 + aY * _23 + aZ * _33;
|
||||||
|
_44 += aX * _14 + aY * _24 + aZ * _34;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const Matrix4x4& o) const
|
bool operator==(const Matrix4x4& o) const
|
||||||
{
|
{
|
||||||
// XXX would be nice to memcmp here, but that breaks IEEE 754 semantics
|
// XXX would be nice to memcmp here, but that breaks IEEE 754 semantics
|
||||||
|
|
|
@ -80,6 +80,32 @@ struct ParamTraits<mozilla::gfx::Matrix>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct ParamTraits<mozilla::gfx::Matrix4x4>
|
||||||
|
{
|
||||||
|
typedef mozilla::gfx::Matrix4x4 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<>
|
template<>
|
||||||
struct ParamTraits<gfxPoint>
|
struct ParamTraits<gfxPoint>
|
||||||
{
|
{
|
||||||
|
|
|
@ -306,7 +306,7 @@ CreateCSSValueList(const InfallibleTArray<TransformFunction>& aFunctions)
|
||||||
case TransformFunction::TTransformMatrix:
|
case TransformFunction::TTransformMatrix:
|
||||||
{
|
{
|
||||||
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_matrix3d, resultTail);
|
arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_matrix3d, resultTail);
|
||||||
const gfx3DMatrix& matrix = aFunctions[i].get_TransformMatrix().value();
|
const gfx::Matrix4x4& matrix = aFunctions[i].get_TransformMatrix().value();
|
||||||
arr->Item(1).SetFloatValue(matrix._11, eCSSUnit_Number);
|
arr->Item(1).SetFloatValue(matrix._11, eCSSUnit_Number);
|
||||||
arr->Item(2).SetFloatValue(matrix._12, eCSSUnit_Number);
|
arr->Item(2).SetFloatValue(matrix._12, eCSSUnit_Number);
|
||||||
arr->Item(3).SetFloatValue(matrix._13, eCSSUnit_Number);
|
arr->Item(3).SetFloatValue(matrix._13, eCSSUnit_Number);
|
||||||
|
|
|
@ -885,16 +885,18 @@ public:
|
||||||
* Tell this layer what its transform should be. The transformation
|
* Tell this layer what its transform should be. The transformation
|
||||||
* is applied when compositing the layer into its parent container.
|
* is applied when compositing the layer into its parent container.
|
||||||
*/
|
*/
|
||||||
void SetBaseTransform(const gfx3DMatrix& aMatrix)
|
void SetBaseTransform(const gfx::Matrix4x4& aMatrix)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!aMatrix.IsSingular(),
|
NS_ASSERTION(!aMatrix.IsSingular(),
|
||||||
"Shouldn't be trying to draw with a singular matrix!");
|
"Shouldn't be trying to draw with a singular matrix!");
|
||||||
mPendingTransform = nullptr;
|
mPendingTransform = nullptr;
|
||||||
if (mTransform == aMatrix) {
|
gfx3DMatrix transform;
|
||||||
|
gfx::To3DMatrix(aMatrix, transform);
|
||||||
|
if (mTransform == transform) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) BaseTransform", this));
|
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) BaseTransform", this));
|
||||||
mTransform = aMatrix;
|
mTransform = transform;
|
||||||
Mutated();
|
Mutated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,9 +908,11 @@ public:
|
||||||
* method enqueues a new transform value to be set immediately after
|
* method enqueues a new transform value to be set immediately after
|
||||||
* the next transaction is opened.
|
* the next transaction is opened.
|
||||||
*/
|
*/
|
||||||
void SetBaseTransformForNextTransaction(const gfx3DMatrix& aMatrix)
|
void SetBaseTransformForNextTransaction(const gfx::Matrix4x4& aMatrix)
|
||||||
{
|
{
|
||||||
mPendingTransform = new gfx3DMatrix(aMatrix);
|
gfx3DMatrix matrix;
|
||||||
|
gfx::To3DMatrix(aMatrix, matrix);
|
||||||
|
mPendingTransform = new gfx3DMatrix(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPostScale(float aXScale, float aYScale)
|
void SetPostScale(float aXScale, float aYScale)
|
||||||
|
|
|
@ -392,7 +392,9 @@ SampleValue(float aPortion, Animation& aAnimation, nsStyleAnimation::Value& aSta
|
||||||
transform.Translate(scaledOrigin);
|
transform.Translate(scaledOrigin);
|
||||||
|
|
||||||
InfallibleTArray<TransformFunction> functions;
|
InfallibleTArray<TransformFunction> functions;
|
||||||
functions.AppendElement(TransformMatrix(transform));
|
Matrix4x4 realTransform;
|
||||||
|
ToMatrix4x4(transform, realTransform);
|
||||||
|
functions.AppendElement(TransformMatrix(realTransform));
|
||||||
*aValue = functions;
|
*aValue = functions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +449,8 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
|
||||||
}
|
}
|
||||||
case eCSSProperty_transform:
|
case eCSSProperty_transform:
|
||||||
{
|
{
|
||||||
gfx3DMatrix matrix = interpolatedValue.get_ArrayOfTransformFunction()[0].get_TransformMatrix().value();
|
gfx3DMatrix matrix;
|
||||||
|
gfx::To3DMatrix(interpolatedValue.get_ArrayOfTransformFunction()[0].get_TransformMatrix().value(), matrix);
|
||||||
if (ContainerLayer* c = aLayer->AsContainerLayer()) {
|
if (ContainerLayer* c = aLayer->AsContainerLayer()) {
|
||||||
matrix.ScalePost(c->GetInheritedXScale(),
|
matrix.ScalePost(c->GetInheritedXScale(),
|
||||||
c->GetInheritedYScale(),
|
c->GetInheritedYScale(),
|
||||||
|
|
|
@ -20,6 +20,7 @@ include "ImageLayers.h";
|
||||||
using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
|
using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
|
||||||
using struct gfxRGBA from "gfxColor.h";
|
using struct gfxRGBA from "gfxColor.h";
|
||||||
using struct gfxPoint3D from "gfxPoint3D.h";
|
using struct gfxPoint3D from "gfxPoint3D.h";
|
||||||
|
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
|
||||||
using class gfx3DMatrix from "gfx3DMatrix.h";
|
using class gfx3DMatrix from "gfx3DMatrix.h";
|
||||||
using nscoord from "nsCoord.h";
|
using nscoord from "nsCoord.h";
|
||||||
using struct nsIntPoint from "nsPoint.h";
|
using struct nsIntPoint from "nsPoint.h";
|
||||||
|
@ -110,7 +111,7 @@ struct Scale {
|
||||||
struct Skew { float x; float y; };
|
struct Skew { float x; float y; };
|
||||||
struct SkewX { float x; };
|
struct SkewX { float x; };
|
||||||
struct SkewY { float y; };
|
struct SkewY { float y; };
|
||||||
struct TransformMatrix { gfx3DMatrix value; };
|
struct TransformMatrix { Matrix4x4 value; };
|
||||||
struct Translation {
|
struct Translation {
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
|
|
|
@ -489,7 +489,9 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies, bool
|
||||||
common.eventRegions() = mutant->GetEventRegions();
|
common.eventRegions() = mutant->GetEventRegions();
|
||||||
common.postXScale() = mutant->GetPostXScale();
|
common.postXScale() = mutant->GetPostXScale();
|
||||||
common.postYScale() = mutant->GetPostYScale();
|
common.postYScale() = mutant->GetPostYScale();
|
||||||
common.transform() = mutant->GetBaseTransform();
|
gfx::Matrix4x4 transform;
|
||||||
|
gfx::ToMatrix4x4(mutant->GetBaseTransform(), transform);
|
||||||
|
common.transform() = transform;
|
||||||
common.contentFlags() = mutant->GetContentFlags();
|
common.contentFlags() = mutant->GetContentFlags();
|
||||||
common.opacity() = mutant->GetOpacity();
|
common.opacity() = mutant->GetOpacity();
|
||||||
common.useClipRect() = !!mutant->GetClipRect();
|
common.useClipRect() = !!mutant->GetClipRect();
|
||||||
|
|
|
@ -815,8 +815,8 @@ TEST(APZCTreeManager, HitTesting2) {
|
||||||
gfx3DMatrix transformToGecko;
|
gfx3DMatrix transformToGecko;
|
||||||
|
|
||||||
// Set a CSS transform on one of the layers.
|
// Set a CSS transform on one of the layers.
|
||||||
gfx3DMatrix transform;
|
Matrix4x4 transform;
|
||||||
transform.ScalePost(2, 1, 1);
|
transform = transform * Matrix4x4().Scale(2, 1, 1);
|
||||||
layers[2]->SetBaseTransform(transform);
|
layers[2]->SetBaseTransform(transform);
|
||||||
|
|
||||||
// Make some other layers scrollable.
|
// Make some other layers scrollable.
|
||||||
|
|
|
@ -218,7 +218,9 @@ already_AddRefed<Layer> CreateLayerTree(
|
||||||
} else {
|
} else {
|
||||||
nsRefPtr<Layer> layer = CreateLayer(aLayerTreeDescription[i], manager.get());
|
nsRefPtr<Layer> layer = CreateLayer(aLayerTreeDescription[i], manager.get());
|
||||||
layer->SetVisibleRegion(aVisibleRegions[layerNumber]);
|
layer->SetVisibleRegion(aVisibleRegions[layerNumber]);
|
||||||
layer->SetBaseTransform(aTransforms[layerNumber]);
|
Matrix4x4 transform;
|
||||||
|
ToMatrix4x4(aTransforms[layerNumber], transform);
|
||||||
|
layer->SetBaseTransform(transform);
|
||||||
aLayersOut.AppendElement(layer);
|
aLayersOut.AppendElement(layer);
|
||||||
layerNumber++;
|
layerNumber++;
|
||||||
if (rootLayer && !parentContainerLayer) {
|
if (rootLayer && !parentContainerLayer) {
|
||||||
|
|
|
@ -1497,15 +1497,15 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
|
||||||
RoundToMatchResidual(scaledOffset.y, data->mAnimatedGeometryRootPosition.y));
|
RoundToMatchResidual(scaledOffset.y, data->mAnimatedGeometryRootPosition.y));
|
||||||
data->mTranslation = pixOffset;
|
data->mTranslation = pixOffset;
|
||||||
pixOffset += mParameters.mOffset;
|
pixOffset += mParameters.mOffset;
|
||||||
gfxMatrix matrix;
|
Matrix matrix;
|
||||||
matrix.Translate(gfxPoint(pixOffset.x, pixOffset.y));
|
matrix.Translate(pixOffset.x, pixOffset.y);
|
||||||
layer->SetBaseTransform(gfx3DMatrix::From2D(matrix));
|
layer->SetBaseTransform(Matrix4x4::From2D(matrix));
|
||||||
|
|
||||||
// FIXME: Temporary workaround for bug 681192 and bug 724786.
|
// FIXME: Temporary workaround for bug 681192 and bug 724786.
|
||||||
#ifndef MOZ_ANDROID_OMTC
|
#ifndef MOZ_ANDROID_OMTC
|
||||||
// Calculate exact position of the top-left of the active scrolled root.
|
// Calculate exact position of the top-left of the active scrolled root.
|
||||||
// This might not be 0,0 due to the snapping in ScaleToNearestPixels.
|
// This might not be 0,0 due to the snapping in ScaleToNearestPixels.
|
||||||
gfxPoint animatedGeometryRootTopLeft = scaledOffset - matrix.GetTranslation() + mParameters.mOffset;
|
gfxPoint animatedGeometryRootTopLeft = scaledOffset - ThebesPoint(matrix.GetTranslation()) + mParameters.mOffset;
|
||||||
// If it has changed, then we need to invalidate the entire layer since the
|
// If it has changed, then we need to invalidate the entire layer since the
|
||||||
// pixels in the layer buffer have the content at a (subpixel) offset
|
// pixels in the layer buffer have the content at a (subpixel) offset
|
||||||
// from what we need.
|
// from what we need.
|
||||||
|
@ -1780,7 +1780,9 @@ ContainerState::PopThebesLayerData()
|
||||||
colorLayer->SetColor(data->mSolidColor);
|
colorLayer->SetColor(data->mSolidColor);
|
||||||
|
|
||||||
// Copy transform
|
// Copy transform
|
||||||
colorLayer->SetBaseTransform(data->mLayer->GetBaseTransform());
|
Matrix4x4 base;
|
||||||
|
ToMatrix4x4(data->mLayer->GetBaseTransform(), base);
|
||||||
|
colorLayer->SetBaseTransform(base);
|
||||||
colorLayer->SetPostScale(data->mLayer->GetPostXScale(), data->mLayer->GetPostYScale());
|
colorLayer->SetPostScale(data->mLayer->GetPostXScale(), data->mLayer->GetPostYScale());
|
||||||
|
|
||||||
nsIntRect visibleRect = data->mVisibleRegion.GetBounds();
|
nsIntRect visibleRect = data->mVisibleRegion.GetBounds();
|
||||||
|
@ -2985,7 +2987,9 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the inverse of our resolution-scale on the layer
|
// Store the inverse of our resolution-scale on the layer
|
||||||
aLayer->SetBaseTransform(transform);
|
Matrix4x4 baseTransform;
|
||||||
|
ToMatrix4x4(transform, baseTransform);
|
||||||
|
aLayer->SetBaseTransform(baseTransform);
|
||||||
aLayer->SetPreScale(1.0f/float(scale.width),
|
aLayer->SetPreScale(1.0f/float(scale.width),
|
||||||
1.0f/float(scale.height));
|
1.0f/float(scale.height));
|
||||||
aLayer->SetInheritedScale(aIncomingScale.mXScale,
|
aLayer->SetInheritedScale(aIncomingScale.mXScale,
|
||||||
|
@ -3830,8 +3834,8 @@ ContainerState::SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip,
|
||||||
maskLayer->SetContainer(container);
|
maskLayer->SetContainer(container);
|
||||||
|
|
||||||
maskTransform.Invert();
|
maskTransform.Invert();
|
||||||
gfx3DMatrix matrix = gfx3DMatrix::From2D(ThebesMatrix(maskTransform));
|
Matrix4x4 matrix = Matrix4x4::From2D(maskTransform);
|
||||||
matrix.Translate(gfxPoint3D(mParameters.mOffset.x, mParameters.mOffset.y, 0));
|
matrix.Translate(mParameters.mOffset.x, mParameters.mOffset.y, 0);
|
||||||
maskLayer->SetBaseTransform(matrix);
|
maskLayer->SetBaseTransform(matrix);
|
||||||
|
|
||||||
// save the details of the clip in user data
|
// save the details of the clip in user data
|
||||||
|
|
|
@ -224,7 +224,7 @@ static void AddTransformFunctions(nsCSSValueList* aList,
|
||||||
}
|
}
|
||||||
case eCSSKeyword_matrix:
|
case eCSSKeyword_matrix:
|
||||||
{
|
{
|
||||||
gfx3DMatrix matrix;
|
gfx::Matrix4x4 matrix;
|
||||||
matrix._11 = array->Item(1).GetFloatValue();
|
matrix._11 = array->Item(1).GetFloatValue();
|
||||||
matrix._12 = array->Item(2).GetFloatValue();
|
matrix._12 = array->Item(2).GetFloatValue();
|
||||||
matrix._13 = 0;
|
matrix._13 = 0;
|
||||||
|
@ -246,7 +246,7 @@ static void AddTransformFunctions(nsCSSValueList* aList,
|
||||||
}
|
}
|
||||||
case eCSSKeyword_matrix3d:
|
case eCSSKeyword_matrix3d:
|
||||||
{
|
{
|
||||||
gfx3DMatrix matrix;
|
gfx::Matrix4x4 matrix;
|
||||||
matrix._11 = array->Item(1).GetFloatValue();
|
matrix._11 = array->Item(1).GetFloatValue();
|
||||||
matrix._12 = array->Item(2).GetFloatValue();
|
matrix._12 = array->Item(2).GetFloatValue();
|
||||||
matrix._13 = array->Item(3).GetFloatValue();
|
matrix._13 = array->Item(3).GetFloatValue();
|
||||||
|
@ -275,7 +275,9 @@ static void AddTransformFunctions(nsCSSValueList* aList,
|
||||||
canStoreInRuleTree,
|
canStoreInRuleTree,
|
||||||
aBounds,
|
aBounds,
|
||||||
aAppUnitsPerPixel);
|
aAppUnitsPerPixel);
|
||||||
aFunctions.AppendElement(TransformMatrix(matrix));
|
gfx::Matrix4x4 transform;
|
||||||
|
gfx::ToMatrix4x4(matrix, transform);
|
||||||
|
aFunctions.AppendElement(TransformMatrix(transform));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eCSSKeyword_perspective:
|
case eCSSKeyword_perspective:
|
||||||
|
@ -1967,11 +1969,12 @@ nsDisplayBackgroundImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& a
|
||||||
mozilla::gfx::IntSize imageSize = mImageContainer->GetCurrentSize();
|
mozilla::gfx::IntSize imageSize = mImageContainer->GetCurrentSize();
|
||||||
NS_ASSERTION(imageSize.width != 0 && imageSize.height != 0, "Invalid image size!");
|
NS_ASSERTION(imageSize.width != 0 && imageSize.height != 0, "Invalid image size!");
|
||||||
|
|
||||||
gfxMatrix transform;
|
gfxPoint p = mDestRect.TopLeft() + aOffset;
|
||||||
transform.Translate(mDestRect.TopLeft() + aOffset);
|
gfx::Matrix transform;
|
||||||
|
transform.Translate(p.x, p.y);
|
||||||
transform.Scale(mDestRect.width/imageSize.width,
|
transform.Scale(mDestRect.width/imageSize.width,
|
||||||
mDestRect.height/imageSize.height);
|
mDestRect.height/imageSize.height);
|
||||||
aLayer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
|
||||||
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageSize.width, imageSize.height));
|
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageSize.width, imageSize.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4851,7 +4851,9 @@ nsIFrame::TryUpdateTransformOnly()
|
||||||
!gfx::FuzzyEqual(transform.yx, previousTransform.yx, kError)) {
|
!gfx::FuzzyEqual(transform.yx, previousTransform.yx, kError)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
layer->SetBaseTransformForNextTransaction(transform3d);
|
gfx::Matrix4x4 matrix;
|
||||||
|
gfx::ToMatrix4x4(transform3d, matrix);
|
||||||
|
layer->SetBaseTransformForNextTransaction(matrix);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,10 +266,11 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
presContext->AppUnitsToGfxUnits(area.height));
|
presContext->AppUnitsToGfxUnits(area.height));
|
||||||
|
|
||||||
// Transform the canvas into the right place
|
// Transform the canvas into the right place
|
||||||
gfxMatrix transform;
|
gfx::Matrix transform;
|
||||||
transform.Translate(r.TopLeft() + aContainerParameters.mOffset);
|
gfxPoint p = r.TopLeft() + aContainerParameters.mOffset;
|
||||||
|
transform.Translate(p.x, p.y);
|
||||||
transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height);
|
transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height);
|
||||||
layer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
|
||||||
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
|
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
|
||||||
layer->SetVisibleRegion(nsIntRect(0, 0, canvasSize.width, canvasSize.height));
|
layer->SetVisibleRegion(nsIntRect(0, 0, canvasSize.width, canvasSize.height));
|
||||||
|
|
||||||
|
|
|
@ -1360,11 +1360,12 @@ nsDisplayImage::ConfigureLayer(ImageLayer *aLayer, const nsIntPoint& aOffset)
|
||||||
|
|
||||||
const gfxRect destRect = GetDestRect();
|
const gfxRect destRect = GetDestRect();
|
||||||
|
|
||||||
gfxMatrix transform;
|
gfx::Matrix transform;
|
||||||
transform.Translate(destRect.TopLeft() + aOffset);
|
gfxPoint p = destRect.TopLeft() + aOffset;
|
||||||
|
transform.Translate(p.x, p.y);
|
||||||
transform.Scale(destRect.Width()/imageWidth,
|
transform.Scale(destRect.Width()/imageWidth,
|
||||||
destRect.Height()/imageHeight);
|
destRect.Height()/imageHeight);
|
||||||
aLayer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
|
||||||
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight));
|
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1637,10 +1637,11 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a transform on the layer to draw the plugin in the right place
|
// Set a transform on the layer to draw the plugin in the right place
|
||||||
gfxMatrix transform;
|
Matrix transform;
|
||||||
transform.Translate(r.TopLeft() + aContainerParameters.mOffset);
|
gfxPoint p = r.TopLeft() + aContainerParameters.mOffset;
|
||||||
|
transform.Translate(p.x, p.y);
|
||||||
|
|
||||||
layer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
layer->SetBaseTransform(Matrix4x4::From2D(transform));
|
||||||
layer->SetVisibleRegion(ThebesIntRect(IntRect(IntPoint(0, 0), size)));
|
layer->SetVisibleRegion(ThebesIntRect(IntRect(IntPoint(0, 0), size)));
|
||||||
return layer.forget();
|
return layer.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,10 +215,11 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
|
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
|
||||||
layer->SetContentFlags(Layer::CONTENT_OPAQUE);
|
layer->SetContentFlags(Layer::CONTENT_OPAQUE);
|
||||||
// Set a transform on the layer to draw the video in the right place
|
// Set a transform on the layer to draw the video in the right place
|
||||||
gfxMatrix transform;
|
gfx::Matrix transform;
|
||||||
transform.Translate(r.TopLeft() + aContainerParameters.mOffset);
|
gfxPoint p = r.TopLeft() + aContainerParameters.mOffset;
|
||||||
|
transform.Translate(p.x, p.y);
|
||||||
transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height);
|
transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height);
|
||||||
layer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
|
||||||
layer->SetVisibleRegion(nsIntRect(0, 0, frameSize.width, frameSize.height));
|
layer->SetVisibleRegion(nsIntRect(0, 0, frameSize.width, frameSize.height));
|
||||||
nsRefPtr<Layer> result = layer.forget();
|
nsRefPtr<Layer> result = layer.forget();
|
||||||
return result.forget();
|
return result.forget();
|
||||||
|
|
|
@ -850,8 +850,8 @@ RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
// container, but our display item is LAYER_ACTIVE_FORCE which
|
// container, but our display item is LAYER_ACTIVE_FORCE which
|
||||||
// forces all layers above to be active.
|
// forces all layers above to be active.
|
||||||
MOZ_ASSERT(aContainerParameters.mOffset == nsIntPoint());
|
MOZ_ASSERT(aContainerParameters.mOffset == nsIntPoint());
|
||||||
gfx3DMatrix m =
|
gfx::Matrix4x4 m;
|
||||||
gfx3DMatrix::Translation(offset.x, offset.y, 0.0);
|
m.Translate(offset.x, offset.y, 0.0);
|
||||||
// Remote content can't be repainted by us, so we multiply down
|
// Remote content can't be repainted by us, so we multiply down
|
||||||
// the resolution that our container expects onto our container.
|
// the resolution that our container expects onto our container.
|
||||||
m.Scale(aContainerParameters.mXScale, aContainerParameters.mYScale, 1.0);
|
m.Scale(aContainerParameters.mXScale, aContainerParameters.mYScale, 1.0);
|
||||||
|
|
|
@ -400,11 +400,12 @@ nsDisplayXULImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& aOffset)
|
||||||
|
|
||||||
NS_ASSERTION(imageWidth != 0 && imageHeight != 0, "Invalid image size!");
|
NS_ASSERTION(imageWidth != 0 && imageHeight != 0, "Invalid image size!");
|
||||||
|
|
||||||
gfxMatrix transform;
|
gfxPoint p = destRect.TopLeft() + aOffset;
|
||||||
transform.Translate(destRect.TopLeft() + aOffset);
|
gfx::Matrix transform;
|
||||||
|
transform.Translate(p.x, p.y);
|
||||||
transform.Scale(destRect.Width()/imageWidth,
|
transform.Scale(destRect.Width()/imageWidth,
|
||||||
destRect.Height()/imageHeight);
|
destRect.Height()/imageHeight);
|
||||||
aLayer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
|
||||||
|
|
||||||
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight));
|
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight));
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче