b=568526 (related); add env var for switching 2d canvas to image surfaces; r=bz
authorVladimir Vukicevic <vladimir@pobox.com>
Fri, 28 May 2010 21:13:08 -0700
changeset 42923 76f945869514d0f272077d9e3c25089edae07fa6
parent 42922 c458465578e05553463703065a793280ccf36855
child 42924 4f6dd726a4e7e365f2ad0471e471bdda6e2687c5
push id13524
push uservladimir@mozilla.com
push dateSat, 29 May 2010 04:13:28 +0000
treeherdermozilla-central@76f945869514 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs568526
milestone1.9.3a5pre
first release with
nightly linux32
76f945869514 / 3.7a5pre / 20100529030110 / files
nightly linux64
76f945869514 / 3.7a5pre / 20100529030729 / files
nightly mac
76f945869514 / 3.7a5pre / 20100529030628 / files
nightly win32
76f945869514 / 3.7a5pre / 20100529040313 / files
nightly win64
76f945869514 / 3.7a5pre / 20100529012524 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=568526 (related); add env var for switching 2d canvas to image surfaces; r=bz
content/canvas/src/nsCanvasRenderingContext2D.cpp
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -41,16 +41,17 @@
 #define _USE_MATH_DEFINES
 #endif
 #include <math.h>
 #if defined(XP_WIN) || defined(XP_OS2)
 #include <float.h>
 #endif
 
 #include "prmem.h"
+#include "prenv.h"
 
 #include "nsIServiceManager.h"
 
 #include "nsContentUtils.h"
 
 #include "nsIDOMDocument.h"
 #include "nsIDocument.h"
 #include "nsIDOMCanvasRenderingContext2D.h"
@@ -945,18 +946,22 @@ nsCanvasRenderingContext2D::SetDimension
     nsRefPtr<gfxASurface> surface;
 
     // Check that the dimensions are sane
     if (gfxASurface::CheckSurfaceSize(gfxIntSize(width, height), 0xffff)) {
         gfxASurface::gfxImageFormat format = gfxASurface::ImageFormatARGB32;
         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;
         }
     }
 
     if (surface) {
         if (gCanvasMemoryReporter == nsnull) {