Bug 721639 - Add some canvas optimizations for thumbnail generation [r=mbrubeck]
authorMark Finkle <mfinkle@mozilla.com>
Fri, 27 Jan 2012 14:27:26 -0500
changeset 85601 f5784f097de32f145f3d028e9112894e7cf8c218
parent 85600 9a36661ced48f51080a15b06b0c308a520cb584f
child 85602 77b82d0464b41d26fe4bf107526d95cefbe3eed7
push id21940
push userjdrew@mozilla.com
push dateSun, 29 Jan 2012 02:43:03 +0000
treeherdermozilla-central@ec666b4c8d84 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs721639
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 721639 - Add some canvas optimizations for thumbnail generation [r=mbrubeck]
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -1568,22 +1568,26 @@ Tab.prototype = {
     }
 
     if (transformChanged)
       this.updateTransform();
   },
 
   screenshot: function(aSrc, aDst) {
       if (!this.browser || !this.browser.contentWindow)
-          return;
+        return;
+
       let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
       canvas.setAttribute("width", aDst.width);  
       canvas.setAttribute("height", aDst.height);
+      canvas.setAttribute("moz-opaque", "true");
+
       let ctx = canvas.getContext("2d");
-      ctx.drawWindow(this.browser.contentWindow, 0, 0, aSrc.width, aSrc.height, "rgb(255, 255, 255)");
+      let flags = ctx.DRAWWINDOW_DO_NOT_FLUSH;
+      ctx.drawWindow(this.browser.contentWindow, 0, 0, aSrc.width, aSrc.height, "#fff", flags);
       let message = {
         gecko: {
           type: "Tab:ScreenshotData",
           tabID: this.id,
           width: aDst.width,
           height: aDst.height,
           data: canvas.toDataURL()
         }