B2G/gecko/image/test/mochitest/imgutils.js
// really meaningful if the image is fully loaded first
really meaningful if the image is fully loaded first
really meaningful if the image is fully loaded first
function forceDecode(id)
{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  var img = document.getElementById(id);
  var canvas = document.createElement("canvas");
  var ctx = canvas.getContext("2d");
  ctx.drawImage(img, 0, 0);
}
function forceDecode ( id ) { netscape . security . PrivilegeManager . enablePrivilege ( "UniversalXPConnect" ) ; var img = document . getElementById ( id ) ; var canvas = document . createElement ( "canvas" ) ; var ctx = canvas . getContext ( "2d" ) ; ctx . drawImage ( img , 0 , 0 ) ; }
really meaningful if the image is fully loaded first
really meaningful if the image is fully loaded first
// Get the image // Make a new canvas // Draw the image to the canvas. This forces a synchronous decode