Bug 1155252 - Add a pref to control the maximum canvas 2d size and set it to 0x7ff. r=jrmuizel

This commit is contained in:
Nicolas Silva 2015-04-22 12:06:53 +02:00
parent 6a32ce3434
commit 38812b5661
2 changed files with 4 additions and 1 deletions

View File

@ -1334,7 +1334,8 @@ CanvasRenderingContext2D::EnsureTarget(RenderingMode aRenderingMode)
// Check that the dimensions are sane
IntSize size(mWidth, mHeight);
if (size.width <= 0xFFFF && size.height <= 0xFFFF &&
if (size.width <= gfxPrefs::MaxCanvasSize() &&
size.height <= gfxPrefs::MaxCanvasSize() &&
size.width >= 0 && size.height >= 0) {
SurfaceFormat format = GetSurfaceFormat();
nsIDocument* ownerDoc = nullptr;

View File

@ -205,6 +205,8 @@ private:
DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_frames", CanvasAutoAccelerateMinFrames, int32_t, 30);
DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_seconds", CanvasAutoAccelerateMinSeconds, float, 5.0f);
DECL_GFX_PREF(Live, "gfx.canvas.azure.accelerated", CanvasAzureAccelerated, bool, false);
// 0x7fff is the maximum supported xlib surface size and is more than enough for canvases.
DECL_GFX_PREF(Live, "gfx.canvas.max-size", MaxCanvasSize, uint32_t, 0x7fff);
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items", CanvasSkiaGLCacheItems, int32_t, 256);
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-size", CanvasSkiaGLCacheSize, int32_t, 96);
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.dynamic-cache", CanvasSkiaGLDynamicCache, bool, false);