зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1574493 - Part 3. Stop rounding rects/clips during display list building. r=jrmuizel
Rounding in layout pixels is very close to snapping in raster pixels if there are no transforms involved. This is why it worked most of the time and fell flat in many edge cases. In future parts of this series, we will trust scene building and frame building to do the heavy lifting for snapping purposes. Differential Revision: https://phabricator.services.mozilla.com/D45058 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
554bdc1122
Коммит
25866edb78
|
@ -381,7 +381,7 @@ void AsyncImagePipelineManager::ApplyAsyncImageForPipeline(
|
|||
params.mix_blend_mode = aPipeline->mMixBlendMode;
|
||||
|
||||
Maybe<wr::WrSpatialId> referenceFrameId = builder.PushStackingContext(
|
||||
params, wr::ToRoundedLayoutRect(aPipeline->mScBounds),
|
||||
params, wr::ToLayoutRect(aPipeline->mScBounds),
|
||||
// This is fine to do unconditionally because we only push images here.
|
||||
wr::RasterSpace::Screen());
|
||||
|
||||
|
@ -402,14 +402,13 @@ void AsyncImagePipelineManager::ApplyAsyncImageForPipeline(
|
|||
MOZ_ASSERT(aPipeline->mCurrentTexture->AsWebRenderTextureHost());
|
||||
Range<wr::ImageKey> range_keys(&keys[0], keys.Length());
|
||||
aPipeline->mCurrentTexture->PushDisplayItems(
|
||||
builder, wr::ToRoundedLayoutRect(rect), wr::ToRoundedLayoutRect(rect),
|
||||
builder, wr::ToLayoutRect(rect), wr::ToLayoutRect(rect),
|
||||
aPipeline->mFilter, range_keys);
|
||||
HoldExternalImage(aPipelineId, aEpoch, aPipeline->mCurrentTexture);
|
||||
} else {
|
||||
MOZ_ASSERT(keys.Length() == 1);
|
||||
builder.PushImage(wr::ToRoundedLayoutRect(rect),
|
||||
wr::ToRoundedLayoutRect(rect), true, aPipeline->mFilter,
|
||||
keys[0]);
|
||||
builder.PushImage(wr::ToLayoutRect(rect), wr::ToLayoutRect(rect), true,
|
||||
aPipeline->mFilter, keys[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -304,8 +304,8 @@ Maybe<wr::WrSpaceAndClip> ClipManager::DefineScrollLayers(
|
|||
LayoutDevicePoint scrollOffset =
|
||||
metrics.GetScrollOffset() * metrics.GetDevPixelsPerCSSPixel();
|
||||
return Some(mBuilder->DefineScrollLayer(
|
||||
viewId, parent, wr::ToRoundedLayoutRect(contentRect),
|
||||
wr::ToRoundedLayoutRect(clipBounds), wr::ToLayoutPoint(scrollOffset)));
|
||||
viewId, parent, wr::ToLayoutRect(contentRect),
|
||||
wr::ToLayoutRect(clipBounds), wr::ToLayoutPoint(scrollOffset)));
|
||||
}
|
||||
|
||||
Maybe<wr::WrClipChainId> ClipManager::DefineClipChain(
|
||||
|
@ -342,7 +342,7 @@ Maybe<wr::WrClipChainId> ClipManager::DefineClipChain(
|
|||
// Define the clip
|
||||
spaceAndClip->space = SpatialIdAfterOverride(spaceAndClip->space);
|
||||
wr::WrClipId clipId = mBuilder->DefineClip(
|
||||
spaceAndClip, wr::ToRoundedLayoutRect(clip), &wrRoundedRects);
|
||||
spaceAndClip, wr::ToLayoutRect(clip), &wrRoundedRects);
|
||||
clipIds.AppendElement(clipId);
|
||||
cache[chain] = clipId;
|
||||
CLIP_LOG("cache[%p] <= %zu\n", chain, clipId.id);
|
||||
|
@ -373,7 +373,7 @@ void ClipManager::ItemClips::UpdateSeparateLeaf(
|
|||
Maybe<wr::LayoutRect> clipLeaf;
|
||||
if (mSeparateLeaf) {
|
||||
MOZ_ASSERT(mChain);
|
||||
clipLeaf.emplace(wr::ToRoundedLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
clipLeaf.emplace(wr::ToLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
mChain->mClip.GetClipRect(), aAppUnitsPerDevPixel)));
|
||||
}
|
||||
|
||||
|
|
|
@ -1927,8 +1927,8 @@ bool WebRenderCommandBuilder::PushImage(
|
|||
return false;
|
||||
}
|
||||
|
||||
auto r = wr::ToRoundedLayoutRect(aRect);
|
||||
auto c = wr::ToRoundedLayoutRect(aClip);
|
||||
auto r = wr::ToLayoutRect(aRect);
|
||||
auto c = wr::ToLayoutRect(aClip);
|
||||
aBuilder.PushImage(r, c, !aItem->BackfaceIsHidden(), rendering, key.value());
|
||||
|
||||
return true;
|
||||
|
@ -2563,7 +2563,7 @@ bool WebRenderCommandBuilder::PushItemAsImage(
|
|||
return false;
|
||||
}
|
||||
|
||||
wr::LayoutRect dest = wr::ToRoundedLayoutRect(imageRect);
|
||||
wr::LayoutRect dest = wr::ToLayoutRect(imageRect);
|
||||
gfx::SamplingFilter sampleFilter =
|
||||
nsLayoutUtils::GetSamplingFilterForFrame(aItem->Frame());
|
||||
aBuilder.PushImage(dest, dest, !aItem->BackfaceIsHidden(),
|
||||
|
|
|
@ -315,7 +315,7 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
|
|||
renderRoot == wr::RenderRoot::Default
|
||||
? LayoutDeviceSize(size)
|
||||
: LayoutDeviceSize());
|
||||
wrRects[renderRoot] = wr::ToRoundedLayoutRect(rects[renderRoot]);
|
||||
wrRects[renderRoot] = wr::ToLayoutRect(rects[renderRoot]);
|
||||
}
|
||||
|
||||
wr::DisplayListBuilder builder(
|
||||
|
|
|
@ -263,7 +263,7 @@ void WebRenderImageData::CreateAsyncImageWebRenderCommands(
|
|||
// context need to be done manually and pushed over to the parent side,
|
||||
// where it will be done when we build the display list for the iframe.
|
||||
// That happens in AsyncImagePipelineManager.
|
||||
wr::LayoutRect r = wr::ToRoundedLayoutRect(aBounds);
|
||||
wr::LayoutRect r = wr::ToLayoutRect(aBounds);
|
||||
aBuilder.PushIFrame(r, aIsBackfaceVisible, mPipelineId.ref(),
|
||||
/*ignoreMissingPipelines*/ false);
|
||||
|
||||
|
|
|
@ -6967,17 +6967,46 @@ IntSize nsLayoutUtils::ComputeImageContainerDrawingParameters(
|
|||
}
|
||||
}
|
||||
|
||||
// Compute our size in layer pixels. We may need to revisit this for Android
|
||||
// because mobile websites are rarely displayed at a 1:1
|
||||
// LayoutPixel:ScreenPixel ratio and the snapping here may be insufficient.
|
||||
// Attempt to snap pixels, the same as ComputeSnappedImageDrawingParameters.
|
||||
// Any changes to the algorithm here will need to be reflected there.
|
||||
bool snapped = false;
|
||||
gfxSize gfxLayerSize;
|
||||
const gfx::Matrix& itm = aSc.GetInheritedTransform();
|
||||
if (!itm.HasNonAxisAlignedTransform() && itm._11 > 0.0 && itm._22 > 0.0) {
|
||||
gfxRect rect(gfxPoint(aDestRect.X(), aDestRect.Y()),
|
||||
gfxSize(aDestRect.Width(), aDestRect.Height()));
|
||||
|
||||
gfxPoint p1 = ThebesPoint(itm.TransformPoint(ToPoint(rect.TopLeft())));
|
||||
gfxPoint p2 = ThebesPoint(itm.TransformPoint(ToPoint(rect.TopRight())));
|
||||
gfxPoint p3 = ThebesPoint(itm.TransformPoint(ToPoint(rect.BottomRight())));
|
||||
|
||||
if (p2 == gfxPoint(p1.x, p3.y) || p2 == gfxPoint(p3.x, p1.y)) {
|
||||
p1.Round();
|
||||
p3.Round();
|
||||
|
||||
rect.MoveTo(gfxPoint(std::min(p1.x, p3.x), std::min(p1.y, p3.y)));
|
||||
rect.SizeTo(gfxSize(std::max(p1.x, p3.x) - rect.X(),
|
||||
std::max(p1.y, p3.y) - rect.Y()));
|
||||
|
||||
// An empty size is unacceptable so we ensure our suggested size is at
|
||||
// least 1 pixel wide/tall.
|
||||
gfxLayerSize =
|
||||
gfxSize(std::max(rect.Width(), 1.0), std::max(rect.Height(), 1.0));
|
||||
snapped = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!snapped) {
|
||||
// Compute our size in layer pixels.
|
||||
const LayerIntSize layerSize =
|
||||
RoundedToInt(LayerSize(aDestRect.Width() * scaleFactors.width,
|
||||
aDestRect.Height() * scaleFactors.height));
|
||||
|
||||
// An empty size is unacceptable so we ensure our suggested size is at least
|
||||
// 1 pixel wide/tall.
|
||||
gfxSize gfxLayerSize =
|
||||
gfxLayerSize =
|
||||
gfxSize(std::max(layerSize.width, 1), std::max(layerSize.height, 1));
|
||||
}
|
||||
|
||||
return aImage->OptimalImageSizeForDest(
|
||||
gfxLayerSize, imgIContainer::FRAME_CURRENT, samplingFilter, aFlags);
|
||||
|
|
|
@ -134,11 +134,11 @@ bool nsDisplayButtonBoxShadowOuter::CreateWebRenderCommands(
|
|||
nsRect shadowRect = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
LayoutDeviceRect deviceBox =
|
||||
LayoutDeviceRect::FromAppUnits(shadowRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceBoxRect = wr::ToRoundedLayoutRect(deviceBox);
|
||||
wr::LayoutRect deviceBoxRect = wr::ToLayoutRect(deviceBox);
|
||||
|
||||
LayoutDeviceRect clipRect =
|
||||
LayoutDeviceRect::FromAppUnits(GetPaintRect(), appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceClipRect = wr::ToRoundedLayoutRect(clipRect);
|
||||
wr::LayoutRect deviceClipRect = wr::ToLayoutRect(clipRect);
|
||||
|
||||
bool hasBorderRadius;
|
||||
Unused << nsCSSRendering::HasBoxShadowNativeTheme(mFrame, hasBorderRadius);
|
||||
|
|
|
@ -185,12 +185,12 @@ bool nsDisplayFieldSetBorder::CreateWebRenderCommands(
|
|||
if (!legendRect.IsEmpty()) {
|
||||
// We need to clip out the part of the border where the legend would go
|
||||
auto appUnitsPerDevPixel = frame->PresContext()->AppUnitsPerDevPixel();
|
||||
auto layoutRect = wr::ToRoundedLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
auto layoutRect = wr::ToLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
frame->GetVisualOverflowRectRelativeToSelf() + offset,
|
||||
appUnitsPerDevPixel));
|
||||
|
||||
wr::ComplexClipRegion region;
|
||||
region.rect = wr::ToRoundedLayoutRect(
|
||||
region.rect = wr::ToLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(legendRect, appUnitsPerDevPixel));
|
||||
region.mode = wr::ClipMode::ClipOut;
|
||||
region.radii = wr::EmptyBorderRadius();
|
||||
|
|
|
@ -84,7 +84,7 @@ class TextDrawTarget : public DrawTarget {
|
|||
LayoutDeviceRect layoutBoundsRect =
|
||||
LayoutDeviceRect::FromAppUnits(aBounds, appUnitsPerDevPixel);
|
||||
LayoutDeviceRect layoutClipRect = layoutBoundsRect;
|
||||
mBoundsRect = wr::ToRoundedLayoutRect(layoutBoundsRect);
|
||||
mBoundsRect = wr::ToLayoutRect(layoutBoundsRect);
|
||||
|
||||
// Add 1 pixel of dirty area around clip rect to allow us to paint
|
||||
// antialiased pixels beyond the measured text extents.
|
||||
|
@ -275,7 +275,7 @@ class TextDrawTarget : public DrawTarget {
|
|||
}
|
||||
|
||||
wr::Line decoration;
|
||||
decoration.bounds = wr::ToRoundedLayoutRect(LayoutDeviceRect(pos, size));
|
||||
decoration.bounds = wr::ToLayoutRect(LayoutDeviceRect(pos, size));
|
||||
decoration.wavyLineThickness = 0; // dummy value, unused
|
||||
decoration.color = wr::ToColorF(aColor);
|
||||
decoration.orientation = aVertical ? wr::LineOrientation::Vertical
|
||||
|
@ -310,7 +310,7 @@ class TextDrawTarget : public DrawTarget {
|
|||
wr::Line decoration;
|
||||
|
||||
decoration.bounds =
|
||||
wr::ToRoundedLayoutRect(LayoutDeviceRect::FromUnknownRect(aBounds));
|
||||
wr::ToLayoutRect(LayoutDeviceRect::FromUnknownRect(aBounds));
|
||||
decoration.wavyLineThickness = aThickness;
|
||||
decoration.color = wr::ToColorF(aColor);
|
||||
decoration.orientation = aVertical ? wr::LineOrientation::Vertical
|
||||
|
@ -347,7 +347,7 @@ class TextDrawTarget : public DrawTarget {
|
|||
|
||||
private:
|
||||
wr::LayoutRect ClipRect() {
|
||||
return wr::ToRoundedLayoutRect(mClipStack.LastElement());
|
||||
return wr::ToLayoutRect(mClipStack.LastElement());
|
||||
}
|
||||
LayoutDeviceRect GeckoClipRect() { return mClipStack.LastElement(); }
|
||||
// Whether anything unsupported was encountered. This will result in this
|
||||
|
@ -463,8 +463,7 @@ class TextDrawTarget : public DrawTarget {
|
|||
if (!aRect.Intersects(GeckoClipRect().ToUnknownRect())) {
|
||||
return;
|
||||
}
|
||||
auto rect =
|
||||
wr::ToRoundedLayoutRect(LayoutDeviceRect::FromUnknownRect(aRect));
|
||||
auto rect = wr::ToLayoutRect(LayoutDeviceRect::FromUnknownRect(aRect));
|
||||
auto color =
|
||||
wr::ToColorF(static_cast<const ColorPattern&>(aPattern).mColor);
|
||||
mBuilder.PushRect(rect, ClipRect(), mBackfaceVisible, color);
|
||||
|
@ -491,7 +490,7 @@ class TextDrawTarget : public DrawTarget {
|
|||
if (!rect.Intersects(GeckoClipRect())) {
|
||||
return;
|
||||
}
|
||||
wr::LayoutRect bounds = wr::ToRoundedLayoutRect(rect);
|
||||
wr::LayoutRect bounds = wr::ToLayoutRect(rect);
|
||||
mBuilder.PushBorder(bounds, ClipRect(), true, widths,
|
||||
Range<const wr::BorderSide>(sides, 4), radius);
|
||||
}
|
||||
|
|
|
@ -446,7 +446,6 @@ ImgDrawResult BulletRenderer::CreateWebRenderCommandsForImage(
|
|||
aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
|
||||
LayoutDeviceRect destRect =
|
||||
LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel);
|
||||
destRect.Round();
|
||||
|
||||
Maybe<SVGImageContext> svgContext;
|
||||
gfx::IntSize decodeSize =
|
||||
|
@ -485,7 +484,7 @@ bool BulletRenderer::CreateWebRenderCommandsForPath(
|
|||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) {
|
||||
MOZ_ASSERT(IsPathType());
|
||||
wr::LayoutRect dest = wr::ToRoundedLayoutRect(mPathRect);
|
||||
wr::LayoutRect dest = wr::ToLayoutRect(mPathRect);
|
||||
auto color = wr::ToColorF(ToDeviceColor(mColor));
|
||||
bool isBackfaceVisible = !aItem->BackfaceIsHidden();
|
||||
switch (mListStyleType) {
|
||||
|
|
|
@ -372,8 +372,8 @@ bool nsDisplayCanvasBackgroundColor::CreateWebRenderCommands(
|
|||
LayoutDeviceRect rect =
|
||||
LayoutDeviceRect::FromAppUnits(bgClipRect, appUnitsPerDevPixel);
|
||||
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(rect);
|
||||
aBuilder.PushRect(roundedRect, roundedRect, !BackfaceIsHidden(),
|
||||
wr::LayoutRect r = wr::ToLayoutRect(rect);
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2309,8 +2309,7 @@ bool nsDisplaySelectionOverlay::CreateWebRenderCommands(
|
|||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) {
|
||||
wr::LayoutRect bounds =
|
||||
wr::ToRoundedLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
wr::LayoutRect bounds = wr::ToLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
nsRect(ToReferenceFrame(), Frame()->GetSize()),
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel()));
|
||||
aBuilder.PushRect(bounds, bounds, !BackfaceIsHidden(),
|
||||
|
|
|
@ -163,7 +163,7 @@ class nsDisplayCanvas final : public nsPaintedDisplayItem {
|
|||
// parent side, where it will be done when we build the display list for
|
||||
// the iframe. That happens in WebRenderCompositableHolder.
|
||||
|
||||
wr::LayoutRect r = wr::ToRoundedLayoutRect(bounds);
|
||||
wr::LayoutRect r = wr::ToLayoutRect(bounds);
|
||||
aBuilder.PushIFrame(r, !BackfaceIsHidden(), data->GetPipelineId().ref(),
|
||||
/*ignoreMissingPipelines*/ false);
|
||||
|
||||
|
|
|
@ -1569,7 +1569,7 @@ ImgDrawResult nsImageFrame::DisplayAltFeedbackWithoutLayer(
|
|||
// Clip to this rect so we don't render outside the inner rect
|
||||
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(
|
||||
inner, PresContext()->AppUnitsPerDevPixel());
|
||||
auto wrBounds = wr::ToRoundedLayoutRect(bounds);
|
||||
auto wrBounds = wr::ToLayoutRect(bounds);
|
||||
|
||||
// Draw image
|
||||
ImgDrawResult result = ImgDrawResult::NOT_READY;
|
||||
|
@ -1609,7 +1609,6 @@ ImgDrawResult nsImageFrame::DisplayAltFeedbackWithoutLayer(
|
|||
|
||||
const int32_t factor = PresContext()->AppUnitsPerDevPixel();
|
||||
LayoutDeviceRect destRect(LayoutDeviceRect::FromAppUnits(dest, factor));
|
||||
destRect.Round();
|
||||
|
||||
Maybe<SVGImageContext> svgContext;
|
||||
IntSize decodeSize =
|
||||
|
@ -1641,7 +1640,7 @@ ImgDrawResult nsImageFrame::DisplayAltFeedbackWithoutLayer(
|
|||
nsRect rect(iconXPos, inner.y, size, size);
|
||||
auto devPxRect = LayoutDeviceRect::FromAppUnits(
|
||||
rect, PresContext()->AppUnitsPerDevPixel());
|
||||
auto dest = wr::ToRoundedLayoutRect(devPxRect);
|
||||
auto dest = wr::ToLayoutRect(devPxRect);
|
||||
|
||||
auto borderWidths = wr::ToBorderWidths(1.0, 1.0, 1.0, 1.0);
|
||||
wr::BorderSide side = {color, wr::BorderStyle::Solid};
|
||||
|
@ -1656,7 +1655,7 @@ ImgDrawResult nsImageFrame::DisplayAltFeedbackWithoutLayer(
|
|||
size / 2 - twoPX);
|
||||
devPxRect = LayoutDeviceRect::FromAppUnits(
|
||||
rect, PresContext()->AppUnitsPerDevPixel());
|
||||
dest = wr::ToRoundedLayoutRect(devPxRect);
|
||||
dest = wr::ToLayoutRect(devPxRect);
|
||||
|
||||
aBuilder.PushRoundedRect(dest, wrBounds, isBackfaceVisible, color);
|
||||
}
|
||||
|
@ -1891,7 +1890,6 @@ bool nsDisplayImage::CreateWebRenderCommands(
|
|||
const int32_t factor = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
LayoutDeviceRect destRect(
|
||||
LayoutDeviceRect::FromAppUnits(GetDestRect(), factor));
|
||||
destRect.Round();
|
||||
|
||||
Maybe<SVGImageContext> svgContext;
|
||||
IntSize decodeSize = nsLayoutUtils::ComputeImageContainerDrawingParameters(
|
||||
|
|
|
@ -1505,8 +1505,8 @@ bool nsDisplayRemote::CreateWebRenderCommands(
|
|||
mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
rect += mOffset;
|
||||
|
||||
aBuilder.PushIFrame(mozilla::wr::ToRoundedLayoutRect(rect),
|
||||
!BackfaceIsHidden(), mozilla::wr::AsPipelineId(mLayersId),
|
||||
aBuilder.PushIFrame(mozilla::wr::ToLayoutRect(rect), !BackfaceIsHidden(),
|
||||
mozilla::wr::AsPipelineId(mLayersId),
|
||||
/*ignoreMissingPipelines*/ true);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -3328,7 +3328,7 @@ void nsCSSBorderRenderer::CreateWebRenderCommands(
|
|||
wr::IpcResourceUpdateQueue& aResources,
|
||||
const layers::StackingContextHelper& aSc) {
|
||||
LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect);
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(outerRect);
|
||||
wr::LayoutRect roundedRect = wr::ToLayoutRect(outerRect);
|
||||
wr::LayoutRect clipRect = roundedRect;
|
||||
wr::BorderSide side[4];
|
||||
NS_FOR_CSS_SIDES(i) {
|
||||
|
@ -3345,7 +3345,7 @@ void nsCSSBorderRenderer::CreateWebRenderCommands(
|
|||
if (mLocalClip) {
|
||||
LayoutDeviceRect localClip =
|
||||
LayoutDeviceRect::FromUnknownRect(mLocalClip.value());
|
||||
clipRect = wr::ToRoundedLayoutRect(localClip.Intersect(outerRect));
|
||||
clipRect = wr::ToLayoutRect(localClip.Intersect(outerRect));
|
||||
}
|
||||
|
||||
Range<const wr::BorderSide> wrsides(side, 4);
|
||||
|
@ -3593,7 +3593,7 @@ ImgDrawResult nsCSSBorderImageRenderer::CreateWebRenderCommands(
|
|||
if (!mClip.IsEmpty()) {
|
||||
LayoutDeviceRect clipRect =
|
||||
LayoutDeviceRect::FromAppUnits(mClip, appUnitsPerDevPixel);
|
||||
clip = wr::ToRoundedLayoutRect(clipRect);
|
||||
clip = wr::ToLayoutRect(clipRect);
|
||||
}
|
||||
|
||||
ImgDrawResult drawResult = ImgDrawResult::SUCCESS;
|
||||
|
|
|
@ -3866,16 +3866,16 @@ bool nsDisplaySolidColor::CreateWebRenderCommands(
|
|||
LayoutDeviceRect renderRootRect =
|
||||
aDisplayListBuilder->GetRenderRootRect(renderRoot);
|
||||
wr::LayoutRect intersection =
|
||||
wr::ToRoundedLayoutRect(bounds.Intersect(renderRootRect));
|
||||
wr::ToLayoutRect(bounds.Intersect(renderRootRect));
|
||||
aBuilder.SubBuilder(renderRoot)
|
||||
.PushRect(intersection, intersection, !BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(bounds);
|
||||
wr::LayoutRect r = wr::ToLayoutRect(bounds);
|
||||
|
||||
aBuilder.PushRect(roundedRect, roundedRect, !BackfaceIsHidden(),
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
}
|
||||
|
||||
|
@ -3915,8 +3915,8 @@ bool nsDisplaySolidColorRegion::CreateWebRenderCommands(
|
|||
nsRect rect = iter.Get();
|
||||
LayoutDeviceRect layerRects = LayoutDeviceRect::FromAppUnits(
|
||||
rect, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(layerRects);
|
||||
aBuilder.PushRect(roundedRect, roundedRect, !BackfaceIsHidden(),
|
||||
wr::LayoutRect r = wr::ToLayoutRect(layerRects);
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
}
|
||||
|
||||
|
@ -5181,9 +5181,9 @@ bool nsDisplayBackgroundColor::CreateWebRenderCommands(
|
|||
|
||||
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(
|
||||
mBackgroundRect, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(bounds);
|
||||
wr::LayoutRect r = wr::ToLayoutRect(bounds);
|
||||
|
||||
aBuilder.PushRect(roundedRect, roundedRect, !BackfaceIsHidden(),
|
||||
aBuilder.PushRect(r, r, !BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
|
||||
return true;
|
||||
|
@ -5366,7 +5366,7 @@ bool nsDisplayClearBackground::CreateWebRenderCommands(
|
|||
nsRect(ToReferenceFrame(), mFrame->GetSize()),
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
aBuilder.PushClearRect(wr::ToRoundedLayoutRect(bounds));
|
||||
aBuilder.PushClearRect(wr::ToLayoutRect(bounds));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5539,7 +5539,7 @@ bool nsDisplayCompositorHitTestInfo::CreateWebRenderCommands(
|
|||
const LayoutDeviceRect devRect =
|
||||
LayoutDeviceRect::FromAppUnits(HitTestArea(), mAppUnitsPerDevPixel);
|
||||
|
||||
const wr::LayoutRect rect = wr::ToRoundedLayoutRect(devRect);
|
||||
const wr::LayoutRect rect = wr::ToLayoutRect(devRect);
|
||||
|
||||
aBuilder.PushHitTest(rect, rect, !BackfaceIsHidden());
|
||||
aBuilder.ClearHitTestInfo();
|
||||
|
@ -5611,8 +5611,8 @@ bool nsDisplayCaret::CreateWebRenderCommands(
|
|||
LayoutDeviceRect devHookRect = LayoutDeviceRect::FromAppUnits(
|
||||
hookRect + ToReferenceFrame(), appUnitsPerDevPixel);
|
||||
|
||||
wr::LayoutRect caret = wr::ToRoundedLayoutRect(devCaretRect);
|
||||
wr::LayoutRect hook = wr::ToRoundedLayoutRect(devHookRect);
|
||||
wr::LayoutRect caret = wr::ToLayoutRect(devCaretRect);
|
||||
wr::LayoutRect hook = wr::ToLayoutRect(devHookRect);
|
||||
|
||||
// Note, WR will pixel snap anything that is layout aligned.
|
||||
aBuilder.PushRect(caret, caret, !BackfaceIsHidden(), wr::ToColorF(color));
|
||||
|
@ -5886,8 +5886,8 @@ bool nsDisplayBoxShadowOuter::CreateWebRenderCommands(
|
|||
|
||||
LayoutDeviceRect deviceBox =
|
||||
LayoutDeviceRect::FromAppUnits(shadowRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceBoxRect = wr::ToRoundedLayoutRect(deviceBox);
|
||||
wr::LayoutRect deviceClipRect = wr::ToRoundedLayoutRect(clipRect);
|
||||
wr::LayoutRect deviceBoxRect = wr::ToLayoutRect(deviceBox);
|
||||
wr::LayoutRect deviceClipRect = wr::ToLayoutRect(clipRect);
|
||||
|
||||
LayoutDeviceSize zeroSize;
|
||||
wr::BorderRadius borderRadius =
|
||||
|
@ -6015,7 +6015,7 @@ void nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(
|
|||
// Now translate everything to device pixels.
|
||||
LayoutDeviceRect deviceBoxRect =
|
||||
LayoutDeviceRect::FromAppUnits(shadowRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceClipRect = wr::ToRoundedLayoutRect(clipRect);
|
||||
wr::LayoutRect deviceClipRect = wr::ToLayoutRect(clipRect);
|
||||
Color shadowColor =
|
||||
nsCSSRendering::GetShadowColor(shadow.base, aFrame, 1.0);
|
||||
|
||||
|
@ -7736,7 +7736,7 @@ bool nsDisplayStickyPosition::CreateWebRenderCommands(
|
|||
NSAppUnitsToFloatPixels(appliedOffset.x, auPerDevPixel),
|
||||
NSAppUnitsToFloatPixels(appliedOffset.y, auPerDevPixel)};
|
||||
wr::WrSpatialId spatialId = aBuilder.DefineStickyFrame(
|
||||
wr::ToRoundedLayoutRect(bounds), topMargin.ptrOr(nullptr),
|
||||
wr::ToLayoutRect(bounds), topMargin.ptrOr(nullptr),
|
||||
rightMargin.ptrOr(nullptr), bottomMargin.ptrOr(nullptr),
|
||||
leftMargin.ptrOr(nullptr), vBounds, hBounds, applied);
|
||||
|
||||
|
@ -10031,7 +10031,7 @@ static Maybe<wr::WrClipId> CreateSimpleClipRegion(
|
|||
wr::ToComplexClipRegion(insetRect, radii, appUnitsPerDevPixel));
|
||||
}
|
||||
|
||||
rect = wr::ToRoundedLayoutRect(
|
||||
rect = wr::ToLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(insetRect, appUnitsPerDevPixel));
|
||||
break;
|
||||
}
|
||||
|
@ -10060,7 +10060,7 @@ static Maybe<wr::WrClipId> CreateSimpleClipRegion(
|
|||
clipRegions.AppendElement(wr::ToComplexClipRegion(
|
||||
ellipseRect, ellipseRadii, appUnitsPerDevPixel));
|
||||
|
||||
rect = wr::ToRoundedLayoutRect(
|
||||
rect = wr::ToLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(ellipseRect, appUnitsPerDevPixel));
|
||||
break;
|
||||
}
|
||||
|
@ -10099,7 +10099,7 @@ static Maybe<Pair<wr::WrClipId, HandleOpacity>> CreateWRClipPathAndMasks(
|
|||
}
|
||||
|
||||
wr::WrClipId clipId = aBuilder.DefineClip(
|
||||
Nothing(), wr::ToRoundedLayoutRect(aBounds), nullptr, mask.ptr());
|
||||
Nothing(), wr::ToLayoutRect(aBounds), nullptr, mask.ptr());
|
||||
|
||||
return Some(MakePair(clipId, HandleOpacity::No));
|
||||
}
|
||||
|
@ -10512,7 +10512,7 @@ bool nsDisplayFilters::CreateWebRenderCommands(
|
|||
auto devPxRect = LayoutDeviceRect::FromAppUnits(
|
||||
filterClip.value() + ToReferenceFrame(), auPerDevPixel);
|
||||
wr::WrClipId clipId =
|
||||
aBuilder.DefineClip(Nothing(), wr::ToRoundedLayoutRect(devPxRect));
|
||||
aBuilder.DefineClip(Nothing(), wr::ToLayoutRect(devPxRect));
|
||||
clip = wr::WrStackingContextClip::ClipId(clipId);
|
||||
} else {
|
||||
clip = wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId());
|
||||
|
|
|
@ -603,7 +603,6 @@ ImgDrawResult nsImageRenderer::BuildWebRenderDisplayItems(
|
|||
LayoutDeviceRect destRect =
|
||||
LayoutDeviceRect::FromAppUnits(aDest, appUnitsPerDevPixel);
|
||||
auto stretchSize = wr::ToLayoutSize(destRect.Size());
|
||||
destRect.Round();
|
||||
|
||||
gfx::IntSize decodeSize =
|
||||
nsLayoutUtils::ComputeImageContainerDrawingParameters(
|
||||
|
@ -630,15 +629,15 @@ ImgDrawResult nsImageRenderer::BuildWebRenderDisplayItems(
|
|||
break;
|
||||
}
|
||||
|
||||
wr::LayoutRect roundedDest = wr::ToLayoutRect(destRect);
|
||||
wr::LayoutRect dest = wr::ToLayoutRect(destRect);
|
||||
|
||||
wr::LayoutRect clip = wr::ToRoundedLayoutRect(
|
||||
wr::LayoutRect clip = wr::ToLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(aFill, appUnitsPerDevPixel));
|
||||
|
||||
if (mExtendMode == ExtendMode::CLAMP) {
|
||||
// The image is not repeating. Just push as a regular image.
|
||||
aBuilder.PushImage(roundedDest, clip, !aItem->BackfaceIsHidden(),
|
||||
rendering, key.value());
|
||||
aBuilder.PushImage(dest, clip, !aItem->BackfaceIsHidden(), rendering,
|
||||
key.value());
|
||||
} else {
|
||||
nsPoint firstTilePos = nsLayoutUtils::GetBackgroundFirstTilePos(
|
||||
aDest.TopLeft(), aFill.TopLeft(), aRepeatSize);
|
||||
|
@ -647,18 +646,18 @@ ImgDrawResult nsImageRenderer::BuildWebRenderDisplayItems(
|
|||
aFill.XMost() - firstTilePos.x,
|
||||
aFill.YMost() - firstTilePos.y),
|
||||
appUnitsPerDevPixel);
|
||||
wr::LayoutRect fill = wr::ToRoundedLayoutRect(fillRect);
|
||||
wr::LayoutRect fill = wr::ToLayoutRect(fillRect);
|
||||
|
||||
switch (mExtendMode) {
|
||||
case ExtendMode::REPEAT_Y:
|
||||
fill.origin.x = roundedDest.origin.x;
|
||||
fill.size.width = roundedDest.size.width;
|
||||
stretchSize.width = roundedDest.size.width;
|
||||
fill.origin.x = dest.origin.x;
|
||||
fill.size.width = dest.size.width;
|
||||
stretchSize.width = dest.size.width;
|
||||
break;
|
||||
case ExtendMode::REPEAT_X:
|
||||
fill.origin.y = roundedDest.origin.y;
|
||||
fill.size.height = roundedDest.size.height;
|
||||
stretchSize.height = roundedDest.size.height;
|
||||
fill.origin.y = dest.origin.y;
|
||||
fill.size.height = dest.size.height;
|
||||
stretchSize.height = dest.size.height;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -6925,20 +6925,19 @@ static void CreateWRCommandsForBeveledBorder(
|
|||
for (const auto& segment : segments) {
|
||||
auto rect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(
|
||||
segment.mRect + aOffset, aBorderParams.mAppUnitsPerDevPixel));
|
||||
auto roundedRect = wr::ToRoundedLayoutRect(rect);
|
||||
auto r = wr::ToLayoutRect(rect);
|
||||
auto color = wr::ToColorF(ToDeviceColor(segment.mColor));
|
||||
|
||||
// Adjust for the start bevel if needed.
|
||||
AdjustAndPushBevel(aBuilder, roundedRect, segment.mColor,
|
||||
segment.mStartBevel, aBorderParams.mAppUnitsPerDevPixel,
|
||||
AdjustAndPushBevel(aBuilder, r, segment.mColor, segment.mStartBevel,
|
||||
aBorderParams.mAppUnitsPerDevPixel,
|
||||
aBorderParams.mBackfaceIsVisible, true);
|
||||
|
||||
AdjustAndPushBevel(aBuilder, roundedRect, segment.mColor, segment.mEndBevel,
|
||||
AdjustAndPushBevel(aBuilder, r, segment.mColor, segment.mEndBevel,
|
||||
aBorderParams.mAppUnitsPerDevPixel,
|
||||
aBorderParams.mBackfaceIsVisible, false);
|
||||
|
||||
aBuilder.PushRect(roundedRect, roundedRect,
|
||||
aBorderParams.mBackfaceIsVisible, color);
|
||||
aBuilder.PushRect(r, r, aBorderParams.mBackfaceIsVisible, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6953,7 +6952,7 @@ static void CreateWRCommandsForBorderSegment(
|
|||
auto borderRect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(
|
||||
aBorderParams.mBorderRect + aOffset, aBorderParams.mAppUnitsPerDevPixel));
|
||||
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(borderRect);
|
||||
wr::LayoutRect r = wr::ToLayoutRect(borderRect);
|
||||
wr::BorderSide wrSide[4];
|
||||
NS_FOR_CSS_SIDES(i) {
|
||||
wrSide[i] = wr::ToBorderSide(ToDeviceColor(aBorderParams.mBorderColor),
|
||||
|
@ -6961,8 +6960,7 @@ static void CreateWRCommandsForBorderSegment(
|
|||
}
|
||||
const bool horizontal = aBorderParams.mStartBevelSide == eSideTop ||
|
||||
aBorderParams.mStartBevelSide == eSideBottom;
|
||||
auto borderWidth =
|
||||
horizontal ? roundedRect.size.height : roundedRect.size.width;
|
||||
auto borderWidth = horizontal ? r.size.height : r.size.width;
|
||||
|
||||
// All border style is set to none except left side. So setting the widths of
|
||||
// each side to width of rect is fine.
|
||||
|
@ -6978,9 +6976,8 @@ static void CreateWRCommandsForBorderSegment(
|
|||
}
|
||||
|
||||
Range<const wr::BorderSide> wrsides(wrSide, 4);
|
||||
aBuilder.PushBorder(roundedRect, roundedRect,
|
||||
aBorderParams.mBackfaceIsVisible, borderWidths, wrsides,
|
||||
wr::EmptyBorderRadius());
|
||||
aBuilder.PushBorder(r, r, aBorderParams.mBackfaceIsVisible, borderWidths,
|
||||
wrsides, wr::EmptyBorderRadius());
|
||||
}
|
||||
|
||||
void BCBlockDirSeg::CreateWebRenderCommands(
|
||||
|
|
|
@ -418,7 +418,6 @@ ImgDrawResult nsImageBoxFrame::CreateWebRenderCommands(
|
|||
const int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
|
||||
LayoutDeviceRect fillRect =
|
||||
LayoutDeviceRect::FromAppUnits(dest, appUnitsPerDevPixel);
|
||||
fillRect.Round();
|
||||
|
||||
Maybe<SVGImageContext> svgContext;
|
||||
gfx::IntSize decodeSize =
|
||||
|
|
|
@ -3436,8 +3436,8 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
|
|||
mozilla::layers::RenderRootStateManager* aManager, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance, const nsRect& aRect) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
wr::LayoutRect bounds = wr::ToRoundedLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(aRect, presContext->AppUnitsPerDevPixel()));
|
||||
wr::LayoutRect bounds =
|
||||
wr::ToLayoutRect(LayoutDeviceRect::FromAppUnits(aRect, presContext->AppUnitsPerDevPixel()));
|
||||
|
||||
EventStates eventState = GetContentState(aFrame, aAppearance);
|
||||
|
||||
|
|
|
@ -1243,8 +1243,7 @@ bool nsNativeThemeGTK::CreateWebRenderCommandsForWidget(
|
|||
mozilla::layers::RenderRootStateManager* aManager, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance, const nsRect& aRect) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
wr::LayoutRect bounds =
|
||||
wr::ToRoundedLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
wr::LayoutRect bounds = wr::ToLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
aRect, presContext->AppUnitsPerDevPixel()));
|
||||
|
||||
switch (aAppearance) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче