Index: lib/child/dataCollector.js |
=================================================================== |
--- a/lib/child/dataCollector.js |
+++ b/lib/child/dataCollector.js |
@@ -107,21 +107,21 @@ function* createScreenshot(window, scree |
context.save(); |
context.scale(scalingFactor, scalingFactor); |
context.drawWindow(window, copyX, copyY, copyWidth, copyHeight, "rgb(255,255,255)"); |
context.restore(); |
// Reduce colors |
let pixelData = context.getImageData(0, 0, canvas.width, canvas.height); |
- let max = pixelData.width * pixelData.height * 4; |
+ let data = pixelData.data; |
let mapping = [0x00, 0x55, 0xAA, 0xFF]; |
- for (let i = 0; i < max; i++) |
+ for (let i = 0; i < data.length; i++) |
{ |
- pixelData.data[i] = mapping[pixelData.data[i] >> 6]; |
+ data[i] = mapping[data[i] >> 6]; |
if (i % 5000 == 0) |
{ |
// Take a break every 5000 bytes to prevent browser hangs |
yield new Promise((resolve, reject) => Utils.runAsync(resolve)); |
} |
} |