From 8d6816b2c91aa3ce6df0a28a949dd9c451886f53 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Fri, 28 May 2010 21:13:08 -0700 Subject: [PATCH] b=568526 (related); add env var for switching 2d canvas to image surfaces; r=bz --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 427d3799e0aa..61acc7678b9d 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -46,6 +46,7 @@ #endif #include "prmem.h" +#include "prenv.h" #include "nsIServiceManager.h" @@ -950,8 +951,12 @@ nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height) if (mOpaque) format = gfxASurface::ImageFormatRGB24; - surface = gfxPlatform::GetPlatform()->CreateOffscreenSurface - (gfxIntSize(width, height), format); + if (PR_GetEnv("MOZ_CANVAS_IMAGE_SURFACE")) { + surface = new gfxImageSurface(gfxIntSize(width, height), format); + } else { + surface = gfxPlatform::GetPlatform()->CreateOffscreenSurface + (gfxIntSize(width, height), format); + } if (surface->CairoStatus() != 0) { surface = NULL;