зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1767121 - Change the type of StackingContextHelper::mScale to MatrixScales. r=botond
Fix a minor typo while at it: "Inherrited" -> "Inherited". Differential Revision: https://phabricator.services.mozilla.com/D146298
This commit is contained in:
Родитель
60dd0a5e7f
Коммит
ae67e4906d
|
@ -200,6 +200,10 @@ class BaseMatrix {
|
|||
return BaseMatrix<T>(aScaleX, 0.0f, 0.0f, aScaleY, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
static BaseMatrix<T> Scaling(const BaseMatrixScales<T>& scale) {
|
||||
return Scaling(scale.xScale, scale.yScale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to PreTranslate, but applies a scale instead of a translation.
|
||||
*/
|
||||
|
@ -212,6 +216,10 @@ class BaseMatrix {
|
|||
return *this;
|
||||
}
|
||||
|
||||
BaseMatrix<T>& PreScale(const BaseMatrixScales<T>& scale) {
|
||||
return PreScale(scale.xScale, scale.yScale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to PostTranslate, but applies a scale instead of a translation.
|
||||
*/
|
||||
|
|
|
@ -163,6 +163,11 @@ struct BaseScaleFactors2D {
|
|||
const ScaleFactor<Other, Dst>& aA, const BaseScaleFactors2D& aB) {
|
||||
return BaseScaleFactors2D<Other, Src, T>(aA) / aB;
|
||||
}
|
||||
|
||||
static BaseScaleFactors2D<Src, Dst, T> FromUnknownScale(
|
||||
const BaseScaleFactors2D<UnknownUnits, UnknownUnits, T>& scale) {
|
||||
return BaseScaleFactors2D<Src, Dst, T>(scale.xScale, scale.yScale);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Src, class Dst>
|
||||
|
|
|
@ -43,10 +43,12 @@ static nsSize ComputeDesiredDisplaySizeForAnimation(nsIFrame* aContainerFrame) {
|
|||
}
|
||||
|
||||
/* static */
|
||||
Size ChooseScale(nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem,
|
||||
const nsRect& aVisibleRect, float aXScale, float aYScale,
|
||||
const Matrix& aTransform2d, bool aCanDraw2D) {
|
||||
Size scale;
|
||||
MatrixScales ChooseScale(nsIFrame* aContainerFrame,
|
||||
nsDisplayItem* aContainerItem,
|
||||
const nsRect& aVisibleRect, float aXScale,
|
||||
float aYScale, const Matrix& aTransform2d,
|
||||
bool aCanDraw2D) {
|
||||
MatrixScales scale;
|
||||
// XXX Should we do something for 3D transforms?
|
||||
if (aCanDraw2D && !aContainerFrame->Combines3DTransformWithAncestors() &&
|
||||
!aContainerFrame->HasPerspective()) {
|
||||
|
@ -65,17 +67,17 @@ Size ChooseScale(nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem,
|
|||
// to account
|
||||
nsSize scaledVisibleSize = nsSize(aVisibleRect.Width() * aXScale,
|
||||
aVisibleRect.Height() * aYScale);
|
||||
scale = nsLayoutUtils::ComputeSuitableScaleForAnimation(
|
||||
Size size = nsLayoutUtils::ComputeSuitableScaleForAnimation(
|
||||
aContainerFrame, scaledVisibleSize, displaySize);
|
||||
scale = MatrixScales(size.width, size.height);
|
||||
// multiply by the scale inherited from ancestors--we use a uniform
|
||||
// scale factor to prevent blurring when the layer is rotated.
|
||||
float incomingScale = std::max(aXScale, aYScale);
|
||||
scale.width *= incomingScale;
|
||||
scale.height *= incomingScale;
|
||||
scale = scale * ScaleFactor<UnknownUnits, UnknownUnits>(incomingScale);
|
||||
} else {
|
||||
// Scale factors are normalized to a power of 2 to reduce the number of
|
||||
// resolution changes
|
||||
scale = aTransform2d.ScaleFactors().ToSize();
|
||||
scale = aTransform2d.ScaleFactors();
|
||||
// For frames with a changing scale transform round scale factors up to
|
||||
// nearest power-of-2 boundary so that we don't keep having to redraw
|
||||
// the content as it scales up and down. Rounding up to nearest
|
||||
|
@ -84,8 +86,8 @@ Size ChooseScale(nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem,
|
|||
// 2, avoiding bad downscaling quality.
|
||||
Matrix frameTransform;
|
||||
if (ActiveLayerTracker::IsScaleSubjectToAnimation(aContainerFrame)) {
|
||||
scale.width = gfxUtils::ClampToScaleFactor(scale.width);
|
||||
scale.height = gfxUtils::ClampToScaleFactor(scale.height);
|
||||
scale.xScale = gfxUtils::ClampToScaleFactor(scale.xScale);
|
||||
scale.yScale = gfxUtils::ClampToScaleFactor(scale.yScale);
|
||||
|
||||
// Limit animated scale factors to not grow excessively beyond the
|
||||
// display size.
|
||||
|
@ -95,11 +97,11 @@ Size ChooseScale(nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem,
|
|||
ComputeDesiredDisplaySizeForAnimation(aContainerFrame);
|
||||
maxScale = Max(maxScale, displaySize / aVisibleRect.Size());
|
||||
}
|
||||
if (scale.width > maxScale.width) {
|
||||
scale.width = gfxUtils::ClampToScaleFactor(maxScale.width, true);
|
||||
if (scale.xScale > maxScale.width) {
|
||||
scale.xScale = gfxUtils::ClampToScaleFactor(maxScale.width, true);
|
||||
}
|
||||
if (scale.height > maxScale.height) {
|
||||
scale.height = gfxUtils::ClampToScaleFactor(maxScale.height, true);
|
||||
if (scale.yScale > maxScale.height) {
|
||||
scale.yScale = gfxUtils::ClampToScaleFactor(maxScale.height, true);
|
||||
}
|
||||
} else {
|
||||
// XXX Do we need to move nearly-integer values to integers here?
|
||||
|
@ -107,11 +109,11 @@ Size ChooseScale(nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem,
|
|||
}
|
||||
// If the scale factors are too small, just use 1.0. The content is being
|
||||
// scaled out of sight anyway.
|
||||
if (fabs(scale.width) < 1e-8 || fabs(scale.height) < 1e-8) {
|
||||
scale = Size(1.0, 1.0);
|
||||
if (fabs(scale.xScale) < 1e-8 || fabs(scale.yScale) < 1e-8) {
|
||||
scale = MatrixScales(1.0, 1.0);
|
||||
}
|
||||
} else {
|
||||
scale = Size(1.0, 1.0);
|
||||
scale = MatrixScales(1.0, 1.0);
|
||||
}
|
||||
|
||||
// Prevent the scale from getting too large, to avoid excessive memory
|
||||
|
@ -119,10 +121,8 @@ Size ChooseScale(nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem,
|
|||
// which should be restricted to the display port. But at very large scales
|
||||
// the visible region itself can become excessive due to rounding errors.
|
||||
// Clamping the scale here prevents that.
|
||||
scale =
|
||||
Size(std::min(scale.width, 32768.0f), std::min(scale.height, 32768.0f));
|
||||
|
||||
return scale;
|
||||
return MatrixScales(std::min(scale.xScale, 32768.0f),
|
||||
std::min(scale.yScale, 32768.0f));
|
||||
}
|
||||
|
||||
StackingContextHelper::StackingContextHelper(
|
||||
|
@ -152,17 +152,16 @@ StackingContextHelper::StackingContextHelper(
|
|||
int32_t apd = aContainerFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
nsRect r = LayoutDevicePixel::ToAppUnits(aBounds, apd);
|
||||
mScale = ChooseScale(aContainerFrame, aContainerItem, r,
|
||||
aParentSC.mScale.width, aParentSC.mScale.height,
|
||||
aParentSC.mScale.xScale, aParentSC.mScale.yScale,
|
||||
mInheritedTransform,
|
||||
/* aCanDraw2D = */ true);
|
||||
} else {
|
||||
mScale = gfx::Size(1.0f, 1.0f);
|
||||
mScale = gfx::MatrixScales(1.0f, 1.0f);
|
||||
mInheritedTransform = gfx::Matrix::Scaling(1.f, 1.f);
|
||||
}
|
||||
|
||||
if (aParams.mAnimated) {
|
||||
mSnappingSurfaceTransform =
|
||||
gfx::Matrix::Scaling(mScale.width, mScale.height);
|
||||
mSnappingSurfaceTransform = gfx::Matrix::Scaling(mScale);
|
||||
} else {
|
||||
mSnappingSurfaceTransform =
|
||||
transform2d * aParentSC.mSnappingSurfaceTransform;
|
||||
|
@ -173,11 +172,12 @@ StackingContextHelper::StackingContextHelper(
|
|||
aContainerItem &&
|
||||
aContainerItem->GetType() == DisplayItemType::TYPE_ASYNC_ZOOM &&
|
||||
aContainerItem->Frame()) {
|
||||
double resolution = aContainerItem->Frame()->PresShell()->GetResolution();
|
||||
float resolution = aContainerItem->Frame()->PresShell()->GetResolution();
|
||||
gfx::Matrix transform = gfx::Matrix::Scaling(resolution, resolution);
|
||||
|
||||
mInheritedTransform = transform * aParentSC.mInheritedTransform;
|
||||
mScale = resolution * aParentSC.mScale;
|
||||
mScale =
|
||||
ScaleFactor<UnknownUnits, UnknownUnits>(resolution) * aParentSC.mScale;
|
||||
|
||||
MOZ_ASSERT(!aParams.mAnimated);
|
||||
mSnappingSurfaceTransform = transform * aParentSC.mSnappingSurfaceTransform;
|
||||
|
@ -198,8 +198,7 @@ StackingContextHelper::StackingContextHelper(
|
|||
gfx::Matrix::Scaling(resolution.xScale, resolution.yScale);
|
||||
|
||||
mInheritedTransform = transform * aParentSC.mInheritedTransform;
|
||||
mScale = gfx::Size(aParentSC.mScale.width * resolution.xScale,
|
||||
aParentSC.mScale.height * resolution.yScale);
|
||||
mScale = aParentSC.mScale * resolution;
|
||||
|
||||
MOZ_ASSERT(!aParams.mAnimated);
|
||||
mSnappingSurfaceTransform = transform * aParentSC.mSnappingSurfaceTransform;
|
||||
|
@ -211,7 +210,7 @@ StackingContextHelper::StackingContextHelper(
|
|||
|
||||
auto rasterSpace =
|
||||
mRasterizeLocally
|
||||
? wr::RasterSpace::Local(std::max(mScale.width, mScale.height))
|
||||
? wr::RasterSpace::Local(std::max(mScale.xScale, mScale.yScale))
|
||||
: wr::RasterSpace::Screen();
|
||||
|
||||
MOZ_ASSERT(!aParams.clip.IsNone());
|
||||
|
|
|
@ -44,7 +44,7 @@ class MOZ_RAII StackingContextHelper {
|
|||
~StackingContextHelper();
|
||||
|
||||
// Export the inherited scale
|
||||
gfx::Size GetInheritedScale() const { return mScale; }
|
||||
gfx::MatrixScales GetInheritedScale() const { return mScale; }
|
||||
|
||||
const gfx::Matrix& GetInheritedTransform() const {
|
||||
return mInheritedTransform;
|
||||
|
@ -64,7 +64,7 @@ class MOZ_RAII StackingContextHelper {
|
|||
|
||||
private:
|
||||
wr::DisplayListBuilder* mBuilder;
|
||||
gfx::Size mScale;
|
||||
gfx::MatrixScales mScale;
|
||||
gfx::Matrix mInheritedTransform;
|
||||
LayoutDevicePoint mOrigin;
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ struct DIGroup {
|
|||
LayerIntRect mHitTestBounds;
|
||||
LayerIntRect mActualBounds;
|
||||
int32_t mAppUnitsPerDevPixel;
|
||||
gfx::Size mScale;
|
||||
gfx::MatrixScales mScale;
|
||||
ScrollableLayerGuid::ViewID mScrollId;
|
||||
CompositorHitTestInfo mHitInfo;
|
||||
LayerPoint mResidualOffset;
|
||||
|
@ -565,7 +565,7 @@ struct DIGroup {
|
|||
GP("\n\n");
|
||||
GP("Begin EndGroup\n");
|
||||
|
||||
LayoutDeviceToLayerScale2D scale(mScale.width, mScale.height);
|
||||
auto scale = LayoutDeviceToLayerScale2D::FromUnknownScale(mScale);
|
||||
|
||||
auto hitTestRect = mVisibleRect.Intersect(ViewAs<LayerPixel>(
|
||||
mHitTestBounds, PixelCastJustification::LayerIsImage));
|
||||
|
@ -648,9 +648,8 @@ struct DIGroup {
|
|||
recorder, dummyDt, mLayerBounds.ToUnknownRect());
|
||||
// Setup the gfxContext
|
||||
RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt);
|
||||
context->SetMatrix(
|
||||
Matrix::Scaling(mScale.width, mScale.height)
|
||||
.PostTranslate(mResidualOffset.x, mResidualOffset.y));
|
||||
context->SetMatrix(Matrix::Scaling(mScale).PostTranslate(
|
||||
mResidualOffset.x, mResidualOffset.y));
|
||||
|
||||
GP("mInvalidRect: %d %d %d %d\n", mInvalidRect.x, mInvalidRect.y,
|
||||
mInvalidRect.width, mInvalidRect.height);
|
||||
|
@ -1298,7 +1297,7 @@ void Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
|
|||
// WebRender's anti-aliasing approximation is not very good under
|
||||
// non-uniform scales.
|
||||
bool uniformlyScaled =
|
||||
fabs(aGroup->mScale.width - aGroup->mScale.height) < 0.1;
|
||||
fabs(aGroup->mScale.xScale - aGroup->mScale.yScale) < 0.1;
|
||||
|
||||
auto activity = IsItemProbablyActive(
|
||||
item, aBuilder, aResources, aSc, manager, mDisplayListBuilder,
|
||||
|
@ -1605,8 +1604,8 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
|
|||
aWrappingItem->GetUntransformedBounds(aDisplayListBuilder, &snapped);
|
||||
DIGroup& group = groupData->mSubGroup;
|
||||
|
||||
gfx::Size scale = aSc.GetInheritedScale();
|
||||
GP("Inherrited scale %f %f\n", scale.width, scale.height);
|
||||
auto scale = aSc.GetInheritedScale();
|
||||
GP("Inherited scale %f %f\n", scale.xScale, scale.yScale);
|
||||
|
||||
auto trans =
|
||||
ViewAs<LayerPixel>(aSc.GetSnappingSurfaceTransform().GetTranslation());
|
||||
|
@ -1614,14 +1613,14 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
|
|||
LayerPoint residualOffset = trans - snappedTrans;
|
||||
|
||||
auto layerBounds =
|
||||
ScaleToOutsidePixelsOffset(groupBounds, scale.width, scale.height,
|
||||
ScaleToOutsidePixelsOffset(groupBounds, scale.xScale, scale.yScale,
|
||||
appUnitsPerDevPixel, residualOffset);
|
||||
|
||||
const nsRect& untransformedPaintRect =
|
||||
aWrappingItem->GetUntransformedPaintRect();
|
||||
|
||||
auto visibleRect = ScaleToOutsidePixelsOffset(
|
||||
untransformedPaintRect, scale.width, scale.height,
|
||||
untransformedPaintRect, scale.xScale, scale.yScale,
|
||||
appUnitsPerDevPixel, residualOffset)
|
||||
.Intersect(layerBounds);
|
||||
|
||||
|
@ -1630,7 +1629,7 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
|
|||
GP("VisibleRect: %d %d %d %d\n", visibleRect.x, visibleRect.y,
|
||||
visibleRect.width, visibleRect.height);
|
||||
|
||||
GP("Inherrited scale %f %f\n", scale.width, scale.height);
|
||||
GP("Inherited scale %f %f\n", scale.xScale, scale.yScale);
|
||||
|
||||
group.mInvalidRect.SetEmpty();
|
||||
if (group.mAppUnitsPerDevPixel != appUnitsPerDevPixel ||
|
||||
|
@ -1643,8 +1642,8 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
|
|||
}
|
||||
|
||||
if (group.mScale != scale) {
|
||||
GP(" Scale %f %f -> %f %f\n", group.mScale.width, group.mScale.height,
|
||||
scale.width, scale.height);
|
||||
GP(" Scale %f %f -> %f %f\n", group.mScale.xScale, group.mScale.yScale,
|
||||
scale.xScale, scale.yScale);
|
||||
}
|
||||
|
||||
if (group.mResidualOffset != residualOffset) {
|
||||
|
@ -1671,8 +1670,8 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
|
|||
group.mAppUnitsPerDevPixel = appUnitsPerDevPixel;
|
||||
group.mClippedImageBounds = layerBounds;
|
||||
|
||||
g.mTransform = Matrix::Scaling(scale.width, scale.height)
|
||||
.PostTranslate(residualOffset.x, residualOffset.y);
|
||||
g.mTransform =
|
||||
Matrix::Scaling(scale).PostTranslate(residualOffset.x, residualOffset.y);
|
||||
group.mScale = scale;
|
||||
group.mScrollId = scrollId;
|
||||
g.ConstructGroups(aDisplayListBuilder, this, aBuilder, aResources, &group,
|
||||
|
@ -2282,7 +2281,7 @@ static void PaintItemByDrawTarget(nsDisplayItem* aItem, gfx::DrawTarget* aDT,
|
|||
const LayoutDevicePoint& aOffset,
|
||||
const IntRect& visibleRect,
|
||||
nsDisplayListBuilder* aDisplayListBuilder,
|
||||
const gfx::Size& aScale,
|
||||
const gfx::MatrixScales& aScale,
|
||||
Maybe<gfx::DeviceColor>& aHighlight) {
|
||||
MOZ_ASSERT(aDT);
|
||||
|
||||
|
@ -2303,9 +2302,8 @@ static void PaintItemByDrawTarget(nsDisplayItem* aItem, gfx::DrawTarget* aDT,
|
|||
break;
|
||||
}
|
||||
|
||||
context->SetMatrix(context->CurrentMatrix()
|
||||
.PreScale(aScale.width, aScale.height)
|
||||
.PreTranslate(-aOffset.x, -aOffset.y));
|
||||
context->SetMatrix(context->CurrentMatrix().PreScale(aScale).PreTranslate(
|
||||
-aOffset.x, -aOffset.y));
|
||||
if (aDisplayListBuilder->IsPaintingToWindow()) {
|
||||
aItem->Frame()->AddStateBits(NS_FRAME_PAINTED_THEBES);
|
||||
}
|
||||
|
@ -2430,14 +2428,14 @@ WebRenderCommandBuilder::GenerateFallbackData(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
gfx::Size scale = aSc.GetInheritedScale();
|
||||
gfx::Size oldScale = fallbackData->mScale;
|
||||
MatrixScales scale = aSc.GetInheritedScale();
|
||||
MatrixScales oldScale = fallbackData->mScale;
|
||||
// We tolerate slight changes in scale so that we don't, for example,
|
||||
// rerasterize on MotionMark
|
||||
bool differentScale = gfx::FuzzyEqual(scale.width, oldScale.width, 1e-6f) &&
|
||||
gfx::FuzzyEqual(scale.height, oldScale.height, 1e-6f);
|
||||
bool differentScale = gfx::FuzzyEqual(scale.xScale, oldScale.xScale, 1e-6f) &&
|
||||
gfx::FuzzyEqual(scale.yScale, oldScale.yScale, 1e-6f);
|
||||
|
||||
LayoutDeviceToLayerScale2D layerScale(scale.width, scale.height);
|
||||
auto layerScale = LayoutDeviceToLayerScale2D::FromUnknownScale(scale);
|
||||
|
||||
auto trans =
|
||||
ViewAs<LayerPixel>(aSc.GetSnappingSurfaceTransform().GetTranslation());
|
||||
|
@ -2460,20 +2458,20 @@ WebRenderCommandBuilder::GenerateFallbackData(
|
|||
if (aBuilder.GetInheritedOpacity() == 1.0f &&
|
||||
opacity == wr::OpacityType::Opaque && snap) {
|
||||
dtRect = LayerIntRect::FromUnknownRect(
|
||||
ScaleToNearestPixelsOffset(paintBounds, scale.width, scale.height,
|
||||
ScaleToNearestPixelsOffset(paintBounds, scale.xScale, scale.yScale,
|
||||
appUnitsPerDevPixel, residualOffset));
|
||||
|
||||
visibleRect =
|
||||
LayerIntRect::FromUnknownRect(
|
||||
ScaleToNearestPixelsOffset(buildingRect, scale.width, scale.height,
|
||||
ScaleToNearestPixelsOffset(buildingRect, scale.xScale, scale.yScale,
|
||||
appUnitsPerDevPixel, residualOffset))
|
||||
.Intersect(dtRect);
|
||||
} else {
|
||||
dtRect = ScaleToOutsidePixelsOffset(paintBounds, scale.width, scale.height,
|
||||
dtRect = ScaleToOutsidePixelsOffset(paintBounds, scale.xScale, scale.yScale,
|
||||
appUnitsPerDevPixel, residualOffset);
|
||||
|
||||
visibleRect =
|
||||
ScaleToOutsidePixelsOffset(buildingRect, scale.width, scale.height,
|
||||
ScaleToOutsidePixelsOffset(buildingRect, scale.xScale, scale.yScale,
|
||||
appUnitsPerDevPixel, residualOffset)
|
||||
.Intersect(dtRect);
|
||||
}
|
||||
|
@ -2701,30 +2699,30 @@ Maybe<wr::ImageMask> WebRenderCommandBuilder::BuildWrMaskImage(
|
|||
const int32_t appUnitsPerDevPixel =
|
||||
aMaskItem->Frame()->PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
Size scale = aSc.GetInheritedScale();
|
||||
Size oldScale = maskData->mScale;
|
||||
MatrixScales scale = aSc.GetInheritedScale();
|
||||
MatrixScales oldScale = maskData->mScale;
|
||||
// This scale determination should probably be done using
|
||||
// ChooseScaleAndSetTransform but for now we just fake it.
|
||||
// We tolerate slight changes in scale so that we don't, for example,
|
||||
// rerasterize on MotionMark
|
||||
bool sameScale = FuzzyEqual(scale.width, oldScale.width, 1e-6f) &&
|
||||
FuzzyEqual(scale.height, oldScale.height, 1e-6f);
|
||||
bool sameScale = FuzzyEqual(scale.xScale, oldScale.xScale, 1e-6f) &&
|
||||
FuzzyEqual(scale.yScale, oldScale.yScale, 1e-6f);
|
||||
|
||||
LayerIntRect itemRect =
|
||||
LayerIntRect::FromUnknownRect(bounds.ScaleToOutsidePixels(
|
||||
scale.width, scale.height, appUnitsPerDevPixel));
|
||||
scale.xScale, scale.yScale, appUnitsPerDevPixel));
|
||||
|
||||
LayerIntRect visibleRect =
|
||||
LayerIntRect::FromUnknownRect(
|
||||
aMaskItem->GetBuildingRect().ScaleToOutsidePixels(
|
||||
scale.width, scale.height, appUnitsPerDevPixel))
|
||||
scale.xScale, scale.yScale, appUnitsPerDevPixel))
|
||||
.SafeIntersect(itemRect);
|
||||
|
||||
if (visibleRect.IsEmpty()) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
LayoutDeviceToLayerScale2D layerScale(scale.width, scale.height);
|
||||
LayoutDeviceToLayerScale2D layerScale(scale.xScale, scale.yScale);
|
||||
LayoutDeviceRect imageRect = LayerRect(visibleRect) / layerScale;
|
||||
|
||||
nsPoint maskOffset = aMaskItem->ToReferenceFrame() - bounds.TopLeft();
|
||||
|
@ -2779,7 +2777,7 @@ Maybe<wr::ImageMask> WebRenderCommandBuilder::BuildWrMaskImage(
|
|||
|
||||
context->SetMatrix(context->CurrentMatrix()
|
||||
.PreTranslate(-itemRect.x, -itemRect.y)
|
||||
.PreScale(scale.width, scale.height));
|
||||
.PreScale(scale));
|
||||
|
||||
bool maskPainted = false;
|
||||
bool maskIsComplete = aMaskItem->PaintMask(
|
||||
|
|
|
@ -113,7 +113,8 @@ bool WebRenderLayerManager::Initialize(
|
|||
|
||||
if (textureFactoryIdentifier.mParentBackend == LayersBackend::LAYERS_NONE ||
|
||||
idNamespace.isNothing()) {
|
||||
gfxCriticalNote << "Failed to connect WebRenderBridgeChild. isParent=" << XRE_IsParentProcess();
|
||||
gfxCriticalNote << "Failed to connect WebRenderBridgeChild. isParent="
|
||||
<< XRE_IsParentProcess();
|
||||
aError.Append(hasInitialized ? "_POST"_ns : "_FIRST"_ns);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ class WebRenderFallbackData : public WebRenderUserData {
|
|||
DisplayItemClip mClip;
|
||||
nsRect mBounds;
|
||||
nsRect mBuildingRect;
|
||||
gfx::Size mScale;
|
||||
gfx::MatrixScales mScale;
|
||||
float mOpacity;
|
||||
|
||||
protected:
|
||||
|
@ -376,7 +376,7 @@ class WebRenderMaskData : public WebRenderUserData {
|
|||
LayerIntRect mItemRect;
|
||||
nsPoint mMaskOffset;
|
||||
nsStyleImageLayers mMaskStyle;
|
||||
gfx::Size mScale;
|
||||
gfx::MatrixScales mScale;
|
||||
bool mShouldHandleOpacity;
|
||||
};
|
||||
|
||||
|
|
|
@ -6507,8 +6507,8 @@ CSSIntSize nsLayoutUtils::ComputeSizeForDrawingWithFallback(
|
|||
return imageSize;
|
||||
}
|
||||
|
||||
/* static */ LayerIntRect SnapRectForImage(const gfx::Matrix& aTransform,
|
||||
const gfx::Size& aScaleFactors,
|
||||
/* static */ LayerIntRect SnapRectForImage(
|
||||
const gfx::Matrix& aTransform, const gfx::MatrixScales& aScaleFactors,
|
||||
const LayoutDeviceRect& aRect) {
|
||||
// Attempt to snap pixels, the same as ComputeSnappedImageDrawingParameters.
|
||||
// Any changes to the algorithm here will need to be reflected there.
|
||||
|
@ -6543,10 +6543,8 @@ CSSIntSize nsLayoutUtils::ComputeSizeForDrawingWithFallback(
|
|||
if (!snapped) {
|
||||
// If we couldn't snap directly with the transform, we need to go best
|
||||
// effort in layer pixels.
|
||||
snapRect = RoundedToInt(LayerRect(aRect.X() * aScaleFactors.width,
|
||||
aRect.Y() * aScaleFactors.height,
|
||||
aRect.Width() * aScaleFactors.width,
|
||||
aRect.Height() * aScaleFactors.height));
|
||||
snapRect = RoundedToInt(
|
||||
aRect * LayoutDeviceToLayerScale2D::FromUnknownScale(aScaleFactors));
|
||||
}
|
||||
|
||||
// An empty size is unacceptable so we ensure our suggested size is at least
|
||||
|
@ -6569,14 +6567,14 @@ IntSize nsLayoutUtils::ComputeImageContainerDrawingParameters(
|
|||
MOZ_ASSERT(aImage);
|
||||
MOZ_ASSERT(aForFrame);
|
||||
|
||||
gfx::Size scaleFactors = aSc.GetInheritedScale();
|
||||
MatrixScales scaleFactors = aSc.GetInheritedScale();
|
||||
SamplingFilter samplingFilter =
|
||||
nsLayoutUtils::GetSamplingFilterForFrame(aForFrame);
|
||||
|
||||
// Compute our SVG context parameters, if any. Don't replace the viewport
|
||||
// size if it was already set, prefer what the caller gave.
|
||||
SVGImageContext::MaybeStoreContextPaint(aSVGContext, aForFrame, aImage);
|
||||
if ((scaleFactors.width != 1.0 || scaleFactors.height != 1.0) &&
|
||||
if ((scaleFactors.xScale != 1.0 || scaleFactors.yScale != 1.0) &&
|
||||
aImage->GetType() == imgIContainer::TYPE_VECTOR &&
|
||||
(!aSVGContext || !aSVGContext->GetViewportSize())) {
|
||||
gfxSize gfxDestSize(aDestRect.Width(), aDestRect.Height());
|
||||
|
|
|
@ -1360,7 +1360,7 @@ bool nsDisplayRemote::CreateWebRenderCommands(
|
|||
visibleRect -= destRect.TopLeft();
|
||||
|
||||
// Generate an effects update notifying the browser it is visible
|
||||
gfx::Size scale = aSc.GetInheritedScale();
|
||||
MatrixScales scale = aSc.GetInheritedScale();
|
||||
|
||||
ParentLayerToScreenScale2D transformToAncestorScale =
|
||||
ParentLayerToParentLayerScale(
|
||||
|
@ -1370,9 +1370,8 @@ bool nsDisplayRemote::CreateWebRenderCommands(
|
|||
mFrame);
|
||||
|
||||
aDisplayListBuilder->AddEffectUpdate(
|
||||
remoteBrowser,
|
||||
EffectsInfo::VisibleWithinRect(visibleRect, {scale.width, scale.height},
|
||||
transformToAncestorScale));
|
||||
remoteBrowser, EffectsInfo::VisibleWithinRect(
|
||||
visibleRect, scale, transformToAncestorScale));
|
||||
|
||||
// Create a WebRenderRemoteData to notify the RemoteBrowser when it is no
|
||||
// longer visible
|
||||
|
|
Загрузка…
Ссылка в новой задаче