From 9e250c015ebd742ffeb49b243196f0fc6878c7b2 Mon Sep 17 00:00:00 2001 From: Nicola Date: Mon, 24 Oct 2022 12:40:34 +0200 Subject: [PATCH] Added willReadFrequently attribute --- js/FileManager.js | 3 +++ js/LayerList.js | 1 + 2 files changed, 4 insertions(+) diff --git a/js/FileManager.js b/js/FileManager.js index 56e507c..da47494 100644 --- a/js/FileManager.js +++ b/js/FileManager.js @@ -73,6 +73,9 @@ const FileManager = (() => { let emptyCanvas = document.createElement("canvas"); let layersCopy = currFile.layers.slice(); + exportCanvas.getContext("2d").willReadFrequently = true; + emptyCanvas.getContext("2d").willReadFrequently = true; + exportCanvas.width = currFile.canvasSize[0]; exportCanvas.height = currFile.canvasSize[1]; diff --git a/js/LayerList.js b/js/LayerList.js index dfa6999..5ef2ff8 100644 --- a/js/LayerList.js +++ b/js/LayerList.js @@ -63,6 +63,7 @@ const LayerList = (() => { // Creating a layer object let newLayer = new Layer(currFile.canvasSize[0], currFile.canvasSize[1], newCanvas, toAppend); newLayer.context.fillStyle = currFile.currentLayer.context.fillStyle; + newLayer.context.willReadFrequently = true; newLayer.copyData(currFile.currentLayer); // currFile.layers.splice(index, 0, newLayer);