Fix for "Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true" warning in chrome browser

This commit is contained in:
Vishwas R 2023-06-27 11:27:43 +05:30
parent 6020386bbe
commit 9cdc7b2045

View File

@ -220,7 +220,7 @@ export class DocumentCloner {
clonedCanvas.width = canvas.width; clonedCanvas.width = canvas.width;
clonedCanvas.height = canvas.height; clonedCanvas.height = canvas.height;
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext('2d');
const clonedCtx = clonedCanvas.getContext('2d'); const clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });
if (clonedCtx) { if (clonedCtx) {
if (!this.options.allowTaint && ctx) { if (!this.options.allowTaint && ctx) {
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0); clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);