Bug 1435291 - Part 2. Make background SVGs use WebRender instead of fallback. r=jrmuizel
This commit is contained in:
@@ -154,12 +154,6 @@ WebRenderLayerManager::GetCompositorBridgeChild()
|
||||
return WrBridge()->GetCompositorBridgeChild();
|
||||
}
|
||||
|
||||
int32_t
|
||||
WebRenderLayerManager::GetMaxTextureSize() const
|
||||
{
|
||||
return WrBridge()->GetMaxTextureSize();
|
||||
}
|
||||
|
||||
bool
|
||||
WebRenderLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
||||
{
|
||||
|
||||
@@ -63,7 +63,8 @@ public:
|
||||
WebRenderLayerManager* AsWebRenderLayerManager() override { return this; }
|
||||
virtual CompositorBridgeChild* GetCompositorBridgeChild() override;
|
||||
|
||||
virtual int32_t GetMaxTextureSize() const override;
|
||||
// WebRender can handle images larger than the max texture size via tiling.
|
||||
virtual int32_t GetMaxTextureSize() const override { return INT32_MAX; }
|
||||
|
||||
virtual bool BeginTransactionWithTarget(gfxContext* aTarget) override;
|
||||
virtual bool BeginTransaction() override;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/SVGSVGElement.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Tuple.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
@@ -860,13 +859,20 @@ VectorImage::GetImageContainerSize(LayerManager* aManager,
|
||||
NS_IMETHODIMP_(bool)
|
||||
VectorImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
if (mError || !mIsFullyLoaded || mHaveAnimations ||
|
||||
aManager->GetBackendType() != LayersBackend::LAYERS_WR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
|
||||
VectorImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
||||
{
|
||||
MOZ_ASSERT(aManager->GetBackendType() != LayersBackend::LAYERS_WR,
|
||||
"WebRender should always use GetImageContainerAvailableAtSize!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -876,14 +882,9 @@ VectorImage::IsImageContainerAvailableAtSize(LayerManager* aManager,
|
||||
const IntSize& aSize,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
if (mError || !mIsFullyLoaded || aSize.IsEmpty() ||
|
||||
mHaveAnimations || !gfxVars::GetUseWebRenderOrDefault()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t maxTextureSize = aManager->GetMaxTextureSize();
|
||||
return aSize.width <= maxTextureSize &&
|
||||
aSize.height <= maxTextureSize;
|
||||
// Since we only support image containers with WebRender, and it can handle
|
||||
// textures larger than the hw max texture size, we don't need to check aSize.
|
||||
return !aSize.IsEmpty() && IsImageContainerAvailable(aManager, aFlags);
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "GeckoProfiler.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/gfx/Tools.h"
|
||||
#include "mozilla/gfx/SourceSurfaceRawData.h"
|
||||
#include "mozilla/layers/SourceSurfaceSharedData.h"
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
|
||||
# RUN TESTS NOT AFFECTED BY DOWNSCALE-DURING-DECODE:
|
||||
# ==================================================
|
||||
fuzzy-if(skiaContent,14,416) fails-if(webrender) == downscale-svg-1a.html downscale-svg-1-ref.html?80
|
||||
fuzzy(80,468) == downscale-svg-1b.html downscale-svg-1-ref.html?72
|
||||
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),1,62) fuzzy-if(skiaContent,8,292) == downscale-svg-1c.html downscale-svg-1-ref.html?64
|
||||
fuzzy(17,208) == downscale-svg-1d.html downscale-svg-1-ref.html?53
|
||||
fuzzy(80,216) fuzzy-if(skiaContent,110,181) == downscale-svg-1e.html downscale-svg-1-ref.html?40
|
||||
fuzzy(51,90) fuzzy-if(skiaContent,142,77) == downscale-svg-1f.html downscale-svg-1-ref.html?24
|
||||
fuzzy-if(skiaContent,14,416) fuzzy-if(webrender,102-102,396-396) == downscale-svg-1a.html downscale-svg-1-ref.html?80
|
||||
fuzzy(80,468) fuzzy-if(webrender,65-65,579-579) == downscale-svg-1b.html downscale-svg-1-ref.html?72
|
||||
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),1,62) fuzzy-if(skiaContent,8,292) fuzzy-if(webrender,14-14,316-316) == downscale-svg-1c.html downscale-svg-1-ref.html?64
|
||||
fuzzy(17,208) fuzzy-if(webrender,83-83,325-325) == downscale-svg-1d.html downscale-svg-1-ref.html?53
|
||||
fuzzy(80,216) fuzzy-if(skiaContent,110,181) fuzzy-if(webrender,84-84,216-216) == downscale-svg-1e.html downscale-svg-1-ref.html?40
|
||||
fuzzy(51,90) fuzzy-if(skiaContent,142,77) fuzzy-if(webrender,62-62,98-98) == downscale-svg-1f.html downscale-svg-1-ref.html?24
|
||||
|
||||
# RUN TESTS WITH DOWNSCALE-DURING-DECODE DISABLED:
|
||||
# ================================================
|
||||
|
||||
@@ -7181,22 +7181,24 @@ nsLayoutUtils::ComputeImageContainerDrawingParameters(imgIContainer*
|
||||
SamplingFilter samplingFilter =
|
||||
nsLayoutUtils::GetSamplingFilterForFrame(aForFrame);
|
||||
|
||||
// Compute our SVG context parameters, if any.
|
||||
// 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) &&
|
||||
aImage->GetType() == imgIContainer::TYPE_VECTOR) {
|
||||
if (!aSVGContext) {
|
||||
aSVGContext.emplace();
|
||||
}
|
||||
|
||||
aImage->GetType() == imgIContainer::TYPE_VECTOR &&
|
||||
(!aSVGContext || !aSVGContext->GetViewportSize())) {
|
||||
gfxSize gfxDestSize(aDestRect.Width(), aDestRect.Height());
|
||||
IntSize viewportSize =
|
||||
aImage->OptimalImageSizeForDest(gfxDestSize,
|
||||
imgIContainer::FRAME_CURRENT,
|
||||
samplingFilter, aFlags);
|
||||
|
||||
aSVGContext->SetViewportSize(Some(CSSIntSize(viewportSize.width,
|
||||
viewportSize.height)));
|
||||
CSSIntSize cssViewportSize(viewportSize.width, viewportSize.height);
|
||||
if (!aSVGContext) {
|
||||
aSVGContext.emplace(Some(cssViewportSize));
|
||||
} else {
|
||||
aSVGContext->SetViewportSize(Some(cssViewportSize));
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to snap pixels, the same as ComputeSnappedImageDrawingParameters.
|
||||
|
||||
@@ -600,10 +600,13 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
||||
containerFlags |= imgIContainer::FLAG_SYNC_DECODE;
|
||||
}
|
||||
|
||||
CSSIntSize imageSize(nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(mSize.height));
|
||||
Maybe<SVGImageContext> svgContext(Some(SVGImageContext(Some(imageSize))));
|
||||
|
||||
const int32_t appUnitsPerDevPixel = mForFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(
|
||||
aDest, appUnitsPerDevPixel);
|
||||
Maybe<SVGImageContext> svgContext;
|
||||
gfx::IntSize decodeSize =
|
||||
nsLayoutUtils::ComputeImageContainerDrawingParameters(mImageContainer, mForFrame, destRect,
|
||||
aSc, containerFlags, svgContext);
|
||||
|
||||
@@ -181,8 +181,8 @@ include empty/reftest.list
|
||||
== wide--contain--percent-width-percent-height.html ref-wide-lime768x128-aqua768x128.html
|
||||
== wide--contain--percent-width-percent-height-viewbox.html ref-wide-lime16x128-aqua16x128.html
|
||||
|
||||
== wide--cover--nonpercent-width-nonpercent-height.html ref-wide-lime768x256.html
|
||||
== wide--cover--nonpercent-width-nonpercent-height-viewbox.html ref-wide-lime768x256.html
|
||||
fuzzy-if(webrender,127-127,768-768) == wide--cover--nonpercent-width-nonpercent-height.html ref-wide-lime768x256.html
|
||||
fuzzy-if(webrender,127-127,768-768) == wide--cover--nonpercent-width-nonpercent-height-viewbox.html ref-wide-lime768x256.html
|
||||
== wide--cover--nonpercent-width-omitted-height.html ref-wide-lime768x128-aqua768x128.html
|
||||
== wide--cover--nonpercent-width-omitted-height-viewbox.html ref-wide-lime768x256.html
|
||||
== wide--cover--nonpercent-width-percent-height.html ref-wide-lime768x128-aqua768x128.html
|
||||
|
||||
Reference in New Issue
Block a user