Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1042241 - Avoid encoding/decoding clip canvas r=kgrandon
Browse files Browse the repository at this point in the history
We can just paint the one canvas to the other directly. This
avoids the png encoding/decoding time and will reduce peak memory.
  • Loading branch information
jrmuizel authored and Kai-Zhen Li committed Oct 22, 2014
1 parent cc80ac6 commit 3900365
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions shared/elements/gaia_grid/js/grid_icon_renderer.js
Expand Up @@ -86,16 +86,9 @@
clipCtx.drawImage(img, 0, 0,
clipCanvas.width, clipCanvas.height);

clipCanvas.toBlob((blob) => {
var clipImage = new Image();
clipImage.onload = () => {
shadowCtx.drawImage(clipImage, CANVAS_PADDING, CANVAS_PADDING,
shadowCtx.drawImage(clipCanvas, CANVAS_PADDING, CANVAS_PADDING,
this._maxSize, this._maxSize);
shadowCanvas.toBlob(resolve);
URL.revokeObjectURL(clipImage.src);
};
clipImage.src = URL.createObjectURL(blob);
});
shadowCanvas.toBlob(resolve);
});
},

Expand Down

0 comments on commit 3900365

Please sign in to comment.