B2G/gecko/browser/components/thumbnails/PageThumbs.jsm
/**
   * Captures a thumbnail from a given window and draws it to the given canvas.
   * @param aWindow The DOM window to capture a thumbnail from.
   * @param aCanvas The canvas to draw to.
   */
Captures a thumbnail from a given window and draws it to the given canvas.
@param aWindow The DOM window to capture a thumbnail from.
@param aCanvas The canvas to draw to.
Captures a thumbnail from a given window and draws it to the given canvas . @param aWindow The DOM window to capture a thumbnail from . @param aCanvas The canvas to draw to .
function PageThumbs_captureToCanvas(aWindow, aCanvas) {
    let telemetryCaptureTime = new Date();
    let [sw, sh, scale] = this._determineCropSize(aWindow, aCanvas);
    let ctx = aCanvas.getContext("2d");
    ctx.scale(scale, scale);
    try {
      ctx.drawWindow(aWindow, 0, 0, sw, sh, THUMBNAIL_BG_COLOR,
                     ctx.DRAWWINDOW_DO_NOT_FLUSH);
    } catch (e) {
    }
    let telemetry = Services.telemetry;
    telemetry.getHistogramById("FX_THUMBNAILS_CAPTURE_TIME_MS")
      .add(new Date() - telemetryCaptureTime);
  }
function PageThumbs_captureToCanvas ( aWindow , aCanvas ) { let telemetryCaptureTime = new Date ( ) ; let [ sw , sh , scale ] = this . _determineCropSize ( aWindow , aCanvas ) ; let ctx = aCanvas . getContext ( "2d" ) ; ctx . scale ( scale , scale ) ; try { ctx . drawWindow ( aWindow , 0 , 0 , sw , sh , THUMBNAIL_BG_COLOR , ctx . DRAWWINDOW_DO_NOT_FLUSH ) ; } catch ( e ) { } let telemetry = Services . telemetry ; telemetry . getHistogramById ( "FX_THUMBNAILS_CAPTURE_TIME_MS" ) . add ( new Date ( ) - telemetryCaptureTime ) ; }
Captures a thumbnail from a given window and draws it to the given canvas.
Captures a thumbnail from a given window and draws it to the given canvas .
// Scale the canvas accordingly. // Draw the window contents to the canvas. // We couldn't draw to the canvas for some reason.