Bug 1393077 - Part1. Round the transformed rectangles and transformed points in StackingContextHelper. r=kats
MozReview-Commit-ID: Gk5z6BwsuTM
This commit is contained in:
@@ -168,7 +168,7 @@ StackingContextHelper::ToRelativeLayoutRect(const LayerRect& aRect) const
|
||||
aMaybeScaledRect.Scale(mXScale, mYScale);
|
||||
}
|
||||
|
||||
return wr::ToLayoutRect(aMaybeScaledRect - mOrigin);
|
||||
return wr::ToLayoutRect(RoundedToInt(aMaybeScaledRect - mOrigin));
|
||||
}
|
||||
|
||||
wr::LayoutRect
|
||||
@@ -180,7 +180,8 @@ StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const
|
||||
aMaybeScaledRect.Scale(mXScale, mYScale);
|
||||
}
|
||||
|
||||
return wr::ToLayoutRect(ViewAs<LayerPixel>(aMaybeScaledRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin);
|
||||
return wr::ToLayoutRect(RoundedToInt(ViewAs<LayerPixel>(aMaybeScaledRect,
|
||||
PixelCastJustification::WebRenderHasUnitResolution) - mOrigin));
|
||||
}
|
||||
|
||||
wr::LayoutPoint
|
||||
@@ -189,17 +190,5 @@ StackingContextHelper::ToRelativeLayoutPoint(const LayerPoint& aPoint) const
|
||||
return wr::ToLayoutPoint(aPoint - mOrigin);
|
||||
}
|
||||
|
||||
wr::LayoutRect
|
||||
StackingContextHelper::ToRelativeLayoutRectRounded(const LayoutDeviceRect& aRect) const
|
||||
{
|
||||
// Multiply by the scale inherited from ancestors if exits
|
||||
LayoutDeviceRect aMaybeScaledRect = aRect;
|
||||
if (mXScale != 1.0f || mYScale != 1.0f) {
|
||||
aMaybeScaledRect.Scale(mXScale, mYScale);
|
||||
}
|
||||
|
||||
return wr::ToLayoutRect(RoundedToInt(ViewAs<LayerPixel>(aMaybeScaledRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin));
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -76,12 +76,12 @@ public:
|
||||
// We allow passing in a LayoutDeviceRect for convenience because in a lot of
|
||||
// cases with WebRender display item generate the layout device space is the
|
||||
// same as the layer space. (TODO: try to make this more explicit somehow).
|
||||
// We also round the rectangle to ints after transforming since the output
|
||||
// is the final destination rect.
|
||||
wr::LayoutRect ToRelativeLayoutRect(const LayerRect& aRect) const;
|
||||
wr::LayoutRect ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const;
|
||||
// Same but for points
|
||||
wr::LayoutPoint ToRelativeLayoutPoint(const LayerPoint& aPoint) const;
|
||||
// Same but rounds the rectangle to ints after transforming.
|
||||
wr::LayoutRect ToRelativeLayoutRectRounded(const LayoutDeviceRect& aRect) const;
|
||||
|
||||
// Export the inherited scale
|
||||
gfx::Size GetInheritedScale() const {
|
||||
|
||||
@@ -210,7 +210,7 @@ nsDisplayButtonBoxShadowOuter::CreateWebRenderCommands(
|
||||
nsRect shadowRect = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
LayoutDeviceRect deviceBox =
|
||||
LayoutDeviceRect::FromAppUnits(shadowRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceBoxRect = aSc.ToRelativeLayoutRectRounded(deviceBox);
|
||||
wr::LayoutRect deviceBoxRect = aSc.ToRelativeLayoutRect(deviceBox);
|
||||
|
||||
LayoutDeviceRect clipRect =
|
||||
LayoutDeviceRect::FromAppUnits(mVisibleRect, appUnitsPerDevPixel);
|
||||
|
||||
@@ -478,7 +478,7 @@ BulletRenderer::CreateWebRenderCommandsForImage(nsDisplayItem* aItem,
|
||||
|
||||
const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
|
||||
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel);
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRectRounded(destRect);
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRect(destRect);
|
||||
|
||||
aBuilder.PushImage(dest,
|
||||
dest,
|
||||
|
||||
@@ -4724,8 +4724,8 @@ nsDisplayCaret::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilde
|
||||
LayoutDeviceRect devHookRect = LayoutDeviceRect::FromAppUnits(
|
||||
hookRect + ToReferenceFrame(), appUnitsPerDevPixel);
|
||||
|
||||
wr::LayoutRect caret = aSc.ToRelativeLayoutRectRounded(devCaretRect);
|
||||
wr::LayoutRect hook = aSc.ToRelativeLayoutRectRounded(devHookRect);
|
||||
wr::LayoutRect caret = aSc.ToRelativeLayoutRect(devCaretRect);
|
||||
wr::LayoutRect hook = aSc.ToRelativeLayoutRect(devHookRect);
|
||||
|
||||
// Note, WR will pixel snap anything that is layout aligned.
|
||||
aBuilder.PushRect(caret,
|
||||
@@ -5003,13 +5003,13 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
|
||||
|
||||
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(
|
||||
mBorderImageRenderer->mArea, appUnitsPerDevPixel);
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRectRounded(destRect);
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRect(destRect);
|
||||
|
||||
wr::LayoutRect clip = dest;
|
||||
if (!mBorderImageRenderer->mClip.IsEmpty()) {
|
||||
LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(
|
||||
mBorderImageRenderer->mClip, appUnitsPerDevPixel);
|
||||
clip = aSc.ToRelativeLayoutRectRounded(clipRect);
|
||||
clip = aSc.ToRelativeLayoutRect(clipRect);
|
||||
}
|
||||
|
||||
switch (mBorderImageRenderer->mImageRenderer.GetType()) {
|
||||
@@ -5384,7 +5384,7 @@ nsDisplayBoxShadowOuter::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
|
||||
|
||||
LayoutDeviceRect deviceBox = LayoutDeviceRect::FromAppUnits(
|
||||
shadowRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceBoxRect = aSc.ToRelativeLayoutRectRounded(deviceBox);
|
||||
wr::LayoutRect deviceBoxRect = aSc.ToRelativeLayoutRect(deviceBox);
|
||||
wr::LayoutRect deviceClipRect = aSc.ToRelativeLayoutRect(clipRect);
|
||||
|
||||
// TODO: support non-uniform border radius.
|
||||
|
||||
Reference in New Issue
Block a user