RESOLVED FIXED 272963
Enable willReadFrequently for Cocoa
https://bugs.webkit.org/show_bug.cgi?id=272963
Summary Enable willReadFrequently for Cocoa
Kimmo Kinnunen
Reported 2024-04-19 01:19:41 PDT
Enable willReadFrequently for Cocoa
Attachments
Radar WebKit Bug Importer
Comment 1 2024-04-19 01:20:02 PDT
Kimmo Kinnunen
Comment 2 2024-04-19 01:34:33 PDT
Based on GitHub search, willReadFrequently is used in many relatively popular frameworks. Mainly the use is: - convert image to matrix / number map (height map) / pixel getter * https://github.com/opencv/opencv/blob/a604304e87d9fa0bb44448212ed8abe89836013d/modules/js/src/helpers.js#L62 * https://github.com/mapbox/mapbox-gl-js/blob/541c310343547c76b83fb26c97126bb4f15f9479/src/util/browser.js#L50 * https://github.com/tensorflow/tfjs/blob/68c4de61d530ace87bb0318a4a4b3ca1888dadec/tfjs-backend-webgl/src/kernels/FromPixels.ts#L34 * https://github.com/gorhill/uBlock/blob/a60a43103c12826a0cfb7213a012efb65173f07d/platform/common/vapi-background.js#L820 * https://github.com/CesiumGS/cesium/blob/58bc5ac46d1884656973496942aef15fc08070c4/packages/engine/Source/Core/getImagePixels.js#L35 * https://github.com/maplibre/maplibre-gl-js/blob/1213fe84382303e1452148309b241c887063a316/src/util/browser.ts#L36 * https://github.com/google/skia/blob/7ad507eca0bd223c3bdd392ea72550a45ae0a104/modules/canvaskit/interface.js#L1284 - feature detect global composite alpha bugs in old Chrome/Firefox * https://github.com/paperjs/paper.js/blob/f1f02cc6630cc109a79c77c1b3680338536cf055/src/canvas/BlendMode.js#L231 * https://github.com/phaserjs/phaser/blob/e1d23b98c04a1ed8b455d0b45346041eebbfe5c1/src/device/CanvasFeatures.js#L42 - incorrectly try to do a faster getImageData on already existing context: * https://github.com/pixijs/pixijs/blob/ff67a1d00ebd9d0e887eb075c35c9163d111214f/src/utils/canvas/getCanvasBoundingBox.ts#L42 In practice, I could not find any other use-case than the intention to "get pixel array from Image" from public GitHub.
Kimmo Kinnunen
Comment 3 2024-04-19 02:13:01 PDT
Kimmo Kinnunen
Comment 4 2024-04-19 02:34:47 PDT
For my M1, 500x500 image -> imageData is 3000 for willReadFrequently = true 2000 for willReadFrequently = false
Kimmo Kinnunen
Comment 5 2024-04-19 02:42:12 PDT
Drawing 7x500x500, both are the same (2000).
EWS
Comment 6 2024-04-21 07:41:24 PDT
Committed 277792@main (30489f57ba19): <https://commits.webkit.org/277792@main> Reviewed commits have been landed. Closing PR #27505 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.