mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-22 05:02:11 -03:00
Enable willReadFrequently for canvas 2D contexts
Adds the willReadFrequently: true option to all getContext('2d') calls on temporary canvases in Canvas, CanvasLayers, and SAMDetectorIntegration modules. This improves performance for frequent pixel data reads, addressing potential browser optimization issues.
This commit is contained in:
@@ -338,7 +338,7 @@ async function handleSAMDetectorResult(node: ComfyNode, resultImage: HTMLImageEl
|
||||
const tempCanvas = document.createElement('canvas');
|
||||
tempCanvas.width = canvas.width;
|
||||
tempCanvas.height = canvas.height;
|
||||
const tempCtx = tempCanvas.getContext('2d', {willReadFrequently: true});
|
||||
const tempCtx = tempCanvas.getContext('2d', { willReadFrequently: true });
|
||||
|
||||
if (tempCtx) {
|
||||
tempCtx.drawImage(resultImage, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
Reference in New Issue
Block a user