Bug 801676 - Follow-up: Add comment explaining why we use JPEG instead of PNG in getScreenshot(). r=jlebar DONTBUILD
authorGabriele Svelto <gsvelto@mozilla.com>
Tue, 16 Oct 2012 18:02:53 +0200
changeset 110548 532c0ef6588b0a15b17fd17d2a90773d7003765a
parent 110547 66ea6fd301815d5302bbd957e1f06e1fbfe0d25f
child 110549 71eacb57041d465e7a32ce2bb2f554ef17b11d63
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjlebar
bugs801676
milestone19.0a1
Bug 801676 - Follow-up: Add comment explaining why we use JPEG instead of PNG in getScreenshot(). r=jlebar DONTBUILD
dom/browser-element/BrowserElementChild.js
--- a/dom/browser-element/BrowserElementChild.js
+++ b/dom/browser-element/BrowserElementChild.js
@@ -457,16 +457,19 @@ BrowserElementChild.prototype = {
     var ctx = canvas.getContext("2d");
     canvas.mozOpaque = true;
     canvas.height = content.innerHeight;
     canvas.width = content.innerWidth;
     ctx.drawWindow(content, 0, 0, content.innerWidth,
                    content.innerHeight, "rgb(255,255,255)");
     sendAsyncMsg('got-screenshot', {
       id: data.json.id,
+      // Hack around the fact that we can't specify opaque PNG, this requires
+      // us to unpremultiply the alpha channel which is expensive on ARM
+      // processors because they lack a hardware integer division instruction.
       rv: canvas.toDataURL("image/jpeg")
     });
   },
 
   _recvFireCtxCallback: function(data) {
     debug("Received fireCtxCallback message: (" + data.json.menuitem + ")");
     // We silently ignore if the embedder uses an incorrect id in the callback
     if (data.json.menuitem in this._ctxHandlers) {