Bug 984845 - BrowserElementParent.getScreenshot should return more accurate screenshots. r=fabrice

This commit is contained in:
Vivien Nicolas 2014-03-18 18:44:24 +01:00
Родитель 93246f1384
Коммит 7ebe220b92
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -831,10 +831,16 @@ BrowserElementChild.prototype = {
canvas.width = canvasWidth;
canvas.height = canvasHeight;
var ctx = canvas.getContext("2d", { willReadFrequently: true });
let ctx = canvas.getContext("2d", { willReadFrequently: true });
ctx.scale(scale * devicePixelRatio, scale * devicePixelRatio);
let flags = ctx.DRAWWINDOW_DRAW_VIEW |
ctx.DRAWWINDOW_USE_WIDGET_LAYERS |
ctx.DRAWWINDOW_DO_NOT_FLUSH |
ctx.DRAWWINDOW_ASYNC_DECODE_IMAGES;
ctx.drawWindow(content, 0, 0, content.innerWidth, content.innerHeight,
transparent ? "rgba(255,255,255,0)" : "rgb(255,255,255)");
transparent ? "rgba(255,255,255,0)" : "rgb(255,255,255)",
flags);
// Take a JPEG screenshot by default instead of PNG with alpha channel.
// This requires us to unpremultiply the alpha channel, which