summaryrefslogtreecommitdiffstats
path: root/image
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-04 14:35:31 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-04 14:35:31 -0500
commit7edd685eee95759d66a457cf428f42e0dda94671 (patch)
treec4514958ea133084552be32d331c115afc509daa /image
parent0083d404eff36f873cde465d50cd34b112bd124f (diff)
parentfc7d9fade54dfbe275c4808dabe30a19415082e0 (diff)
downloadUXP-7edd685eee95759d66a457cf428f42e0dda94671.tar
UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.gz
UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.lz
UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.xz
UXP-7edd685eee95759d66a457cf428f42e0dda94671.zip
Merge branch 'master' into configurebuild-work
Diffstat (limited to 'image')
-rw-r--r--image/VectorImage.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp
index 6e3928362..fd970e179 100644
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -931,12 +931,21 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams, BackendTy
RefPtr<gfxDrawable> svgDrawable =
new gfxCallbackDrawable(cb, aParams.size);
+ // We take an early exit without using the surface cache if
+ // 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 = 3000;
+
bool bypassCache = bool(aParams.flags & FLAG_BYPASS_SURFACE_CACHE) ||
// Refuse to cache animated images:
// XXX(seth): We may remove this restriction in bug 922893.
mHaveAnimations ||
// The image is too big to fit in the cache:
- !SurfaceCache::CanHold(aParams.size);
+ !SurfaceCache::CanHold(aParams.size) ||
+ // Image x or y is larger than our cache cap:
+ aParams.size.width > maxDimension ||
+ aParams.size.height > maxDimension;
if (bypassCache) {
return Show(svgDrawable, aParams);
}