mourner / simpleheat

A tiny JavaScript library for drawing heatmaps with Canvas
http://mourner.github.io/simpleheat/demo
BSD 2-Clause "Simplified" License
937 stars 186 forks source link

Add willReadFrequently option when obtaining Canvas2D context #49

Closed caiosm1005 closed 4 months ago

caiosm1005 commented 4 months ago

Recent versions of Google Chrome now issue a warning due to a missing willReadFrequently option when getting the Canvas2D context.

The warning message is as follows:

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

This PR addresses this by adding the option willReadFrequently: true to both getContext() calls that preceed a getImageData() call.