B2G/gecko/browser/devtools/tilt/TiltGL.jsm
/**
   * This shim renders a content window to a canvas element, but clamps the
   * maximum width and height of the canvas to the WebGL MAX_TEXTURE_SIZE.
   *
   * @param {Window} aContentWindow
   *                 the content window to get a texture from
   * @param {Number} aMaxImageSize
   *                 the maximum image size to be used
   *
   * @return {Image} the new content window image
   */
This shim renders a content window to a canvas element, but clamps the
maximum width and height of the canvas to the WebGL MAX_TEXTURE_SIZE.

@param {Window} aContentWindow
the content window to get a texture from
@param {Number} aMaxImageSize
the maximum image size to be used

@return {Image} the new content window image
This shim renders a content window to a canvas element but clamps the maximum width and height of the canvas to the WebGL MAX_TEXTURE_SIZE . @param { Window } aContentWindow the content window to get a texture from @param { Number } aMaxImageSize the maximum image size to be used @return { Image } the new content window image
function TGLTU_createContentImage(
    aContentWindow, aMaxImageSize)
  {
    let size = TiltUtils.DOM.getContentWindowDimensions(aContentWindow);
    let canvas = TiltUtils.DOM.initCanvas(null);
    canvas.width = TiltMath.clamp(size.width, 0, aMaxImageSize);
    canvas.height = TiltMath.clamp(size.height, 0, aMaxImageSize);
    let ctx = canvas.getContext("2d");
    ctx.drawWindow(aContentWindow, 0, 0, canvas.width, canvas.height, "#fff");
    return canvas;
  }
function TGLTU_createContentImage ( aContentWindow , aMaxImageSize ) { let size = TiltUtils . DOM . getContentWindowDimensions ( aContentWindow ) ; let canvas = TiltUtils . DOM . initCanvas ( null ) ; canvas . width = TiltMath . clamp ( size . width , 0 , aMaxImageSize ) ; canvas . height = TiltMath . clamp ( size . height , 0 , aMaxImageSize ) ; let ctx = canvas . getContext ( "2d" ) ; ctx . drawWindow ( aContentWindow , 0 , 0 , canvas . width , canvas . height , "#fff" ) ; return canvas ; }
This shim renders a content window to a canvas element, but clamps the
 maximum width and height of the canvas to the WebGL MAX_TEXTURE_SIZE.
This shim renders a content window to a canvas element but clamps the maximum width and height of the canvas to the WebGL MAX_TEXTURE_SIZE .
// calculate the total width and height of the content page // use a custom canvas element and a 2d context to draw the window // use the 2d context.drawWindow() magic