Bug 1739661. Avoid using D2D when drawing SVG. r=aosmond

This avoids using D2D when creating a cached SVG image.
We can still hit D2D if we're not caching, but that should
be less common.

Differential Revision: https://phabricator.services.mozilla.com/D130513
This commit is contained in:
Jeff Muizelaar 2021-11-10 16:23:17 +00:00
parent fc11ef0b3f
commit f3335d09ea

View file

@ -1080,6 +1080,12 @@ already_AddRefed<SourceSurface> VectorImage::CreateSurface(
aParams.context ? aParams.context->GetDrawTarget()->GetBackendType()
: gfxPlatform::GetPlatform()->GetDefaultContentBackend();
if (backend == BackendType::DIRECT2D1_1) {
// We don't want to draw arbitrary content with D2D anymore
// because it doesn't support PushLayerWithBlend so switch to skia
backend = BackendType::SKIA;
}
// Try to create an imgFrame, initializing the surface it contains by drawing
// our gfxDrawable into it. (We use FILTER_NEAREST since we never scale here.)
auto frame = MakeNotNull<RefPtr<imgFrame>>();