Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization - use willReadFrequently when initializing canvas #236

Open
ymoran00 opened this issue May 18, 2023 · 1 comment
Open

Optimization - use willReadFrequently when initializing canvas #236

ymoran00 opened this issue May 18, 2023 · 1 comment

Comments

@ymoran00
Copy link

Chrome provides this warning:

Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

So adding it may optimize the canvas for some browsers.

@getify
Copy link

getify commented Feb 21, 2024

For reference, here's the line that needs the change:

const context = canvas.getContext('2d', { alpha: false })!;

that options object needs willReadFrequently: true added to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants