Bug 1150774 (Part 1) - Add helpers to simplify using typed units in ConfigureLayer. r=botond

This commit is contained in:
Seth Fowler 2015-04-07 18:55:28 -07:00
parent 7e5ca15a1a
commit 5217e8f84f
3 changed files with 16 additions and 2 deletions

View File

@ -86,17 +86,28 @@ struct ContainerLayerParameters {
, mDisableSubpixelAntialiasingInDescendants(aParent.mDisableSubpixelAntialiasingInDescendants)
, mInLowPrecisionDisplayPort(aParent.mInLowPrecisionDisplayPort)
{}
float mXScale, mYScale;
LayoutDeviceToLayerScale2D Scale() const {
return LayoutDeviceToLayerScale2D(mXScale, mYScale);
}
/**
* If non-null, the rectangle in which BuildContainerLayerFor stores the
* visible rect of the layer, in the coordinate system of the created layer.
*/
nsIntRect* mLayerContentsVisibleRect;
/**
* An offset to apply to all child layers created.
*/
nsIntPoint mOffset;
LayerIntPoint Offset() const {
return LayerIntPoint::FromUntyped(mOffset);
}
nscolor mBackgroundColor;
bool mInTransformedSubtree;
bool mInActiveTransformedSubtree;

View File

@ -309,6 +309,10 @@ struct LayerPixel {
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static nsIntPoint ToUntyped(const LayerIntPoint& aPoint) {
return nsIntPoint(aPoint.x, aPoint.y);
}
static gfx::IntRect ToUnknown(const LayerIntRect& aRect) {
return gfx::IntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}

View File

@ -833,8 +833,7 @@ nsDisplayScrollLayer::ComputeFrameMetrics(nsIFrame* aForFrame,
// all the pres shells from here up to the root, as well as any css-driven
// resolution. We don't need to compute it as it's already stored in the
// container parameters.
metrics.SetCumulativeResolution(LayoutDeviceToLayerScale2D(aContainerParameters.mXScale,
aContainerParameters.mYScale));
metrics.SetCumulativeResolution(aContainerParameters.Scale());
LayoutDeviceToScreenScale2D resolutionToScreen(
presShell->GetCumulativeResolution()