Bug 1814878. Use fallback rendering if rasterizing a vector image will use too big of a surface. r=gfx-reviewers,jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D168784
This commit is contained in:
Timothy Nikkel
2023-02-03 13:46:58 +00:00
parent 3014dbbd04
commit e869dce9f2

View File

@@ -848,6 +848,19 @@ VectorImage::GetImageProvider(WindowRenderer* aRenderer,
return ImgDrawResult::TEMPORARY_ERROR;
}
if (!SurfaceCache::IsLegalSize(aSize) ||
!Factory::AllowedSurfaceSize(aSize)) {
// If either of these is true then the InitWithDrawable call below will
// fail, so fail early and use this opportunity to return NOT_SUPPORTED
// instead of TEMPORARY_ERROR as we do for any InitWithDrawable failure.
// This means that we will use fallback which has a path that will draw
// directly into the gfxContext without having to allocate a surface. It
// means we will have to use fallback and re-rasterize for everytime we
// have to draw this image, but it's better than not drawing anything at
// all.
return ImgDrawResult::NOT_SUPPORTED;
}
// We aren't using blobs, so we need to rasterize.
float animTime =
mHaveAnimations ? mSVGDocumentWrapper->GetCurrentTimeAsFloat() : 0.0f;