mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-06-07 00:48:56 +00:00
Reinstate some caching for vector images with small enough dimensions.
A dimension of 400 largest size x or y should cover all common caching cases for SVG icons and web app elements, but not caching large vector rasters that would exhaust the cache. Final solution for #757.
This commit is contained in:
@@ -837,21 +837,21 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams)
|
||||
nsRefPtr<gfxDrawable> svgDrawable =
|
||||
new gfxCallbackDrawable(cb, ThebesIntSize(aParams.size));
|
||||
|
||||
// We take an early exit here without using the surface cache, 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.
|
||||
return Show(svgDrawable, aParams);
|
||||
// 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.
|
||||
uint32_t maxDimension = 400;
|
||||
|
||||
// ***** Reference: Surface cache code if needed in the future ***** //
|
||||
// e.g. if we want to use the cache for specific (small) sizes
|
||||
#if 0
|
||||
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);
|
||||
|
||||
@@ -886,8 +886,6 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams)
|
||||
nsRefPtr<gfxDrawable> drawable =
|
||||
new gfxSurfaceDrawable(surface, ThebesIntSize(aParams.size));
|
||||
Show(drawable, aParams);
|
||||
#endif
|
||||
// ***** End Reference: Surface cache code ***** //
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user