1ba9c4df77
Depends on https://skia-review.googlesource.com/c/skia/+/186870 It's optional at build time, which is good given that it adds about 2MB of uncompressed size (from 4.3 MB to 6.4 MB) Bug: skia: Change-Id: I5f54ad628b735c3bc880e917394fb27d16849ebe Reviewed-on: https://skia-review.googlesource.com/c/187924 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
19 lines
896 B
JavaScript
19 lines
896 B
JavaScript
// The size of the golden images (DMs)
|
|
const CANVAS_WIDTH = 600;
|
|
const CANVAS_HEIGHT = 600;
|
|
|
|
function reportSurface(surface, testname, done) {
|
|
// In docker, the webgl canvas is blank, but the surface has the pixel
|
|
// data. So, we copy it out and draw it to a normal canvas to take a picture.
|
|
// To be consistent across CPU and GPU, we just do it for all configurations
|
|
// (even though the CPU canvas shows up after flush just fine).
|
|
let pixels = surface.getCanvas().readPixels(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
|
|
pixels = new Uint8ClampedArray(pixels.buffer);
|
|
const imageData = new ImageData(pixels, CANVAS_WIDTH, CANVAS_HEIGHT);
|
|
|
|
let reportingCanvas = document.getElementById('report');
|
|
reportingCanvas.getContext('2d').putImageData(imageData, 0, 0);
|
|
reportCanvas(reportingCanvas, testname).then(() => {
|
|
done();
|
|
}).catch(reportError(done));
|
|
} |