From 2bccdcbcc01ff594e28c623cf07274d86aa64edf Mon Sep 17 00:00:00 2001 From: Pale Moon Date: Sun, 5 Nov 2017 12:20:50 +0100 Subject: [PATCH] Make the SVG scaling limit for the surface cache more lenient. Increase the limit to a royal 32MB/element as cap (if the SVG is square). This still avoids performance regressions when scaling large vector images, but also allows for large SVG backgrounds to be cached. We'll have some performance loss here on e.g. the Chalkboard test (1-2 seconds) because of increased cache management, but it's still considerably faster and smoother than Firefox. At the same time it allows for the bad practice of slapping a large SVG on a site as html background, considering they are likely, even when using large sizes for "responsive" layout, not going to exceed 2850 px in the largest dimension. This resolves #1446, because the largest dimension in use there falls within the new bounds. --- image/src/VectorImage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/image/src/VectorImage.cpp b/image/src/VectorImage.cpp index 5824e94675..d419ace45a 100644 --- a/image/src/VectorImage.cpp +++ b/image/src/VectorImage.cpp @@ -841,7 +841,8 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams) // x or y > maxDimension, because for vector images this can cause bad perf // issues if large sizes are scaled repeatedly (a rather common scenario) // that can quickly exhaust the cache. - int32_t maxDimension = 400; + // 2850 ~= 32MB cache element cap (if square) + int32_t maxDimension = 2850; bool bypassCache = bool(aParams.flags & FLAG_BYPASS_SURFACE_CACHE) || // Refuse to cache animated images: