mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 706179 Part 2: Add a BaseTransform to layers to return the layer's transform without scaling applied r=roc
This commit is contained in:
parent
e14b114016
commit
d29cc0cf63
@ -601,6 +601,14 @@ Layer::CalculateScissorRect(const nsIntRect& aCurrentScissorRect,
|
|||||||
return currentClip.Intersect(scissor);
|
return currentClip.Intersect(scissor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gfx3DMatrix
|
||||||
|
Layer::GetTransform()
|
||||||
|
{
|
||||||
|
gfx3DMatrix transform = mTransform;
|
||||||
|
transform.Scale(mXScale, mYScale, 1);
|
||||||
|
return transform;
|
||||||
|
}
|
||||||
|
|
||||||
const gfx3DMatrix
|
const gfx3DMatrix
|
||||||
Layer::GetLocalTransform()
|
Layer::GetLocalTransform()
|
||||||
{
|
{
|
||||||
|
@ -716,7 +716,7 @@ public:
|
|||||||
* XXX Currently only transformations corresponding to 2D affine transforms
|
* XXX Currently only transformations corresponding to 2D affine transforms
|
||||||
* are supported.
|
* are supported.
|
||||||
*/
|
*/
|
||||||
void SetTransform(const gfx3DMatrix& aMatrix)
|
void SetBaseTransform(const gfx3DMatrix& aMatrix)
|
||||||
{
|
{
|
||||||
mTransform = aMatrix;
|
mTransform = aMatrix;
|
||||||
Mutated();
|
Mutated();
|
||||||
@ -764,7 +764,8 @@ public:
|
|||||||
Layer* GetPrevSibling() { return mPrevSibling; }
|
Layer* GetPrevSibling() { return mPrevSibling; }
|
||||||
virtual Layer* GetFirstChild() { return nsnull; }
|
virtual Layer* GetFirstChild() { return nsnull; }
|
||||||
virtual Layer* GetLastChild() { return nsnull; }
|
virtual Layer* GetLastChild() { return nsnull; }
|
||||||
const gfx3DMatrix& GetTransform() { return mTransform; }
|
const gfx3DMatrix GetTransform();
|
||||||
|
const gfx3DMatrix& GetBaseTransform() { return mTransform; }
|
||||||
float GetXScale() { return mXScale; }
|
float GetXScale() { return mXScale; }
|
||||||
float GetYScale() { return mYScale; }
|
float GetYScale() { return mYScale; }
|
||||||
bool GetIsFixedPosition() { return mIsFixedPosition; }
|
bool GetIsFixedPosition() { return mIsFixedPosition; }
|
||||||
|
@ -526,7 +526,7 @@ SetShadowProperties(Layer* aLayer)
|
|||||||
{
|
{
|
||||||
// FIXME: Bug 717688 -- Do these updates in ShadowLayersParent::RecvUpdate.
|
// FIXME: Bug 717688 -- Do these updates in ShadowLayersParent::RecvUpdate.
|
||||||
ShadowLayer* shadow = aLayer->AsShadowLayer();
|
ShadowLayer* shadow = aLayer->AsShadowLayer();
|
||||||
shadow->SetShadowTransform(aLayer->GetTransform());
|
shadow->SetShadowTransform(aLayer->GetBaseTransform());
|
||||||
shadow->SetShadowVisibleRegion(aLayer->GetVisibleRegion());
|
shadow->SetShadowVisibleRegion(aLayer->GetVisibleRegion());
|
||||||
shadow->SetShadowClipRect(aLayer->GetClipRect());
|
shadow->SetShadowClipRect(aLayer->GetClipRect());
|
||||||
shadow->SetShadowOpacity(aLayer->GetOpacity());
|
shadow->SetShadowOpacity(aLayer->GetOpacity());
|
||||||
@ -696,7 +696,7 @@ CompositorParent::TransformShadowTree(TimeStamp aCurrentFrame)
|
|||||||
|
|
||||||
const FrameMetrics& metrics = container->GetFrameMetrics();
|
const FrameMetrics& metrics = container->GetFrameMetrics();
|
||||||
const gfx3DMatrix& rootTransform = root->GetTransform();
|
const gfx3DMatrix& rootTransform = root->GetTransform();
|
||||||
const gfx3DMatrix& currentTransform = layer->GetTransform();
|
const gfx3DMatrix& currentTransform = layer->GetBaseTransform();
|
||||||
|
|
||||||
// FIXME/bug 775437: unify this interface with the ~native-fennec
|
// FIXME/bug 775437: unify this interface with the ~native-fennec
|
||||||
// derived code
|
// derived code
|
||||||
|
@ -299,7 +299,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
|||||||
LayerAttributes attrs;
|
LayerAttributes attrs;
|
||||||
CommonLayerAttributes& common = attrs.common();
|
CommonLayerAttributes& common = attrs.common();
|
||||||
common.visibleRegion() = mutant->GetVisibleRegion();
|
common.visibleRegion() = mutant->GetVisibleRegion();
|
||||||
common.transform() = mutant->GetTransform();
|
common.transform() = mutant->GetBaseTransform();
|
||||||
common.xScale() = mutant->GetXScale();
|
common.xScale() = mutant->GetXScale();
|
||||||
common.yScale() = mutant->GetYScale();
|
common.yScale() = mutant->GetYScale();
|
||||||
common.contentFlags() = mutant->GetContentFlags();
|
common.contentFlags() = mutant->GetContentFlags();
|
||||||
|
@ -216,7 +216,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||||||
layer->SetContentFlags(common.contentFlags());
|
layer->SetContentFlags(common.contentFlags());
|
||||||
layer->SetOpacity(common.opacity().value());
|
layer->SetOpacity(common.opacity().value());
|
||||||
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
|
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
|
||||||
layer->SetTransform(common.transform().value());
|
layer->SetBaseTransform(common.transform().value());
|
||||||
layer->SetScale(common.xScale(), common.yScale());
|
layer->SetScale(common.xScale(), common.yScale());
|
||||||
static bool fixedPositionLayersEnabled = getenv("MOZ_ENABLE_FIXED_POSITION_LAYERS") != 0;
|
static bool fixedPositionLayersEnabled = getenv("MOZ_ENABLE_FIXED_POSITION_LAYERS") != 0;
|
||||||
if (fixedPositionLayersEnabled) {
|
if (fixedPositionLayersEnabled) {
|
||||||
|
@ -1114,7 +1114,7 @@ ContainerState::CreateOrRecycleThebesLayer(nsIFrame* aActiveScrolledRoot)
|
|||||||
RoundToMatchResidual(scaledOffset.y, data->mActiveScrolledRootPosition.y));
|
RoundToMatchResidual(scaledOffset.y, data->mActiveScrolledRootPosition.y));
|
||||||
gfxMatrix matrix;
|
gfxMatrix matrix;
|
||||||
matrix.Translate(gfxPoint(pixOffset.x, pixOffset.y));
|
matrix.Translate(gfxPoint(pixOffset.x, pixOffset.y));
|
||||||
layer->SetTransform(gfx3DMatrix::From2D(matrix));
|
layer->SetBaseTransform(gfx3DMatrix::From2D(matrix));
|
||||||
|
|
||||||
// FIXME: Temporary workaround for bug 681192 and bug 724786.
|
// FIXME: Temporary workaround for bug 681192 and bug 724786.
|
||||||
#ifndef MOZ_JAVA_COMPOSITOR
|
#ifndef MOZ_JAVA_COMPOSITOR
|
||||||
@ -1267,9 +1267,7 @@ ContainerState::PopThebesLayerData()
|
|||||||
imageLayer->SetContainer(imageContainer);
|
imageLayer->SetContainer(imageContainer);
|
||||||
data->mImage->ConfigureLayer(imageLayer);
|
data->mImage->ConfigureLayer(imageLayer);
|
||||||
// The layer's current transform is applied first, then the result is scaled.
|
// The layer's current transform is applied first, then the result is scaled.
|
||||||
gfx3DMatrix transform = imageLayer->GetTransform()*
|
imageLayer->SetScale(mParameters.mXScale, mParameters.mYScale);
|
||||||
gfx3DMatrix::ScalingMatrix(mParameters.mXScale, mParameters.mYScale, 1.0f);
|
|
||||||
imageLayer->SetTransform(transform);
|
|
||||||
if (data->mItemClip.mHaveClipRect) {
|
if (data->mItemClip.mHaveClipRect) {
|
||||||
nsIntRect clip = ScaleToNearestPixels(data->mItemClip.mClipRect);
|
nsIntRect clip = ScaleToNearestPixels(data->mItemClip.mClipRect);
|
||||||
imageLayer->IntersectClipRect(clip);
|
imageLayer->IntersectClipRect(clip);
|
||||||
@ -1281,7 +1279,8 @@ ContainerState::PopThebesLayerData()
|
|||||||
colorLayer->SetColor(data->mSolidColor);
|
colorLayer->SetColor(data->mSolidColor);
|
||||||
|
|
||||||
// Copy transform
|
// Copy transform
|
||||||
colorLayer->SetTransform(data->mLayer->GetTransform());
|
colorLayer->SetBaseTransform(data->mLayer->GetTransform());
|
||||||
|
colorLayer->SetScale(data->mLayer->GetXScale(), data->mLayer->GetYScale());
|
||||||
|
|
||||||
// Clip colorLayer to its visible region, since ColorLayers are
|
// Clip colorLayer to its visible region, since ColorLayers are
|
||||||
// allowed to paint outside the visible region. Here we rely on the
|
// allowed to paint outside the visible region. Here we rely on the
|
||||||
@ -1780,7 +1779,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
|
|||||||
// The layer's current transform is applied first, then the result is scaled.
|
// The layer's current transform is applied first, then the result is scaled.
|
||||||
gfx3DMatrix transform = ownLayer->GetTransform()*
|
gfx3DMatrix transform = ownLayer->GetTransform()*
|
||||||
gfx3DMatrix::ScalingMatrix(mParameters.mXScale, mParameters.mYScale, 1.0f);
|
gfx3DMatrix::ScalingMatrix(mParameters.mXScale, mParameters.mYScale, 1.0f);
|
||||||
ownLayer->SetTransform(transform);
|
ownLayer->SetBaseTransform(transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
ownLayer->SetIsFixedPosition(
|
ownLayer->SetIsFixedPosition(
|
||||||
@ -2124,7 +2123,7 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
|
|||||||
scale = gfxSize(1.0, 1.0);
|
scale = gfxSize(1.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
aLayer->SetTransform(transform);
|
aLayer->SetBaseTransform(transform);
|
||||||
// Store the inverse of our resolution-scale on the layer
|
// Store the inverse of our resolution-scale on the layer
|
||||||
aLayer->SetScale(1.0f/float(scale.width), 1.0f/float(scale.height));
|
aLayer->SetScale(1.0f/float(scale.width), 1.0f/float(scale.height));
|
||||||
|
|
||||||
@ -3132,7 +3131,7 @@ ContainerState::SetupMaskLayer(Layer *aLayer, const FrameLayerBuilder::Clip& aCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
maskLayer->SetContainer(container);
|
maskLayer->SetContainer(container);
|
||||||
maskLayer->SetTransform(gfx3DMatrix::From2D(maskTransform.Invert()));
|
maskLayer->SetBaseTransform(gfx3DMatrix::From2D(maskTransform.Invert()));
|
||||||
|
|
||||||
// save the details of the clip in user data
|
// save the details of the clip in user data
|
||||||
userData->mScaleX = newData.mScaleX;
|
userData->mScaleX = newData.mScaleX;
|
||||||
|
@ -988,10 +988,10 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Root is being scaled up by the X/Y resolution. Scale it back down.
|
// Root is being scaled up by the X/Y resolution. Scale it back down.
|
||||||
gfx3DMatrix rootTransform = root->GetTransform()*
|
gfx3DMatrix rootTransform = root->GetBaseTransform()*
|
||||||
gfx3DMatrix::ScalingMatrix(1.0f/containerParameters.mXScale,
|
gfx3DMatrix::ScalingMatrix(1.0f/containerParameters.mXScale,
|
||||||
1.0f/containerParameters.mYScale, 1.0f);
|
1.0f/containerParameters.mYScale, 1.0f);
|
||||||
root->SetTransform(rootTransform);
|
root->SetBaseTransform(rootTransform);
|
||||||
|
|
||||||
ViewID id = presContext->IsRootContentDocument() ? FrameMetrics::ROOT_SCROLL_ID
|
ViewID id = presContext->IsRootContentDocument() ? FrameMetrics::ROOT_SCROLL_ID
|
||||||
: FrameMetrics::NULL_SCROLL_ID;
|
: FrameMetrics::NULL_SCROLL_ID;
|
||||||
@ -1650,7 +1650,7 @@ nsDisplayBackground::ConfigureLayer(ImageLayer* aLayer)
|
|||||||
transform.Translate(mDestRect.TopLeft());
|
transform.Translate(mDestRect.TopLeft());
|
||||||
transform.Scale(mDestRect.width/imageSize.width,
|
transform.Scale(mDestRect.width/imageSize.width,
|
||||||
mDestRect.height/imageSize.height);
|
mDestRect.height/imageSize.height);
|
||||||
aLayer->SetTransform(gfx3DMatrix::From2D(transform));
|
aLayer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
||||||
|
|
||||||
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageSize.width, imageSize.height));
|
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageSize.width, imageSize.height));
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||||||
gfxMatrix transform;
|
gfxMatrix transform;
|
||||||
transform.Translate(r.TopLeft());
|
transform.Translate(r.TopLeft());
|
||||||
transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height);
|
transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height);
|
||||||
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
layer->SetBaseTransform(gfx3DMatrix::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));
|
||||||
|
|
||||||
|
@ -1289,7 +1289,7 @@ nsDisplayImage::ConfigureLayer(ImageLayer *aLayer)
|
|||||||
transform.Translate(destRect.TopLeft());
|
transform.Translate(destRect.TopLeft());
|
||||||
transform.Scale(destRect.Width()/imageWidth,
|
transform.Scale(destRect.Width()/imageWidth,
|
||||||
destRect.Height()/imageHeight);
|
destRect.Height()/imageHeight);
|
||||||
aLayer->SetTransform(gfx3DMatrix::From2D(transform));
|
aLayer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
||||||
|
|
||||||
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight));
|
aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight));
|
||||||
}
|
}
|
||||||
|
@ -1723,7 +1723,7 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||||||
gfxMatrix transform;
|
gfxMatrix transform;
|
||||||
transform.Translate(r.TopLeft());
|
transform.Translate(r.TopLeft());
|
||||||
|
|
||||||
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
layer->SetBaseTransform(gfx3DMatrix::From2D(transform));
|
||||||
layer->SetVisibleRegion(nsIntRect(0, 0, size.width, size.height));
|
layer->SetVisibleRegion(nsIntRect(0, 0, size.width, size.height));
|
||||||
return layer.forget();
|
return layer.forget();
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||||||
gfxMatrix transform;
|
gfxMatrix transform;
|
||||||
transform.Translate(r.TopLeft());
|
transform.Translate(r.TopLeft());
|
||||||
transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height);
|
transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height);
|
||||||
layer->SetTransform(gfx3DMatrix::From2D(transform));
|
layer->SetBaseTransform(gfx3DMatrix::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();
|
||||||
|
@ -605,7 +605,7 @@ RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||||||
layer->SetReferentId(id);
|
layer->SetReferentId(id);
|
||||||
layer->SetVisibleRegion(aVisibleRect);
|
layer->SetVisibleRegion(aVisibleRect);
|
||||||
nsIntPoint rootFrameOffset = GetRootFrameOffset(aFrame, aBuilder);
|
nsIntPoint rootFrameOffset = GetRootFrameOffset(aFrame, aBuilder);
|
||||||
layer->SetTransform(
|
layer->SetBaseTransform(
|
||||||
gfx3DMatrix::Translation(rootFrameOffset.x, rootFrameOffset.y, 0.0));
|
gfx3DMatrix::Translation(rootFrameOffset.x, rootFrameOffset.y, 0.0));
|
||||||
|
|
||||||
return layer.forget();
|
return layer.forget();
|
||||||
|
Loading…
Reference in New Issue
Block a user