<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>272963</bug_id>
          
          <creation_ts>2024-04-19 01:19:41 -0700</creation_ts>
          <short_desc>Enable willReadFrequently for Cocoa</short_desc>
          <delta_ts>2024-04-21 07:41:26 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Canvas</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=244117</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kimmo Kinnunen">kkinnunen</reporter>
          <assigned_to name="Kimmo Kinnunen">kkinnunen</assigned_to>
          <cc>dino</cc>
    
    <cc>karlcow</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2029735</commentid>
    <comment_count>0</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2024-04-19 01:19:41 -0700</bug_when>
    <thetext>Enable willReadFrequently for Cocoa</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2029736</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-04-19 01:20:02 -0700</bug_when>
    <thetext>&lt;rdar://problem/126739379&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2029738</commentid>
    <comment_count>2</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2024-04-19 01:34:33 -0700</bug_when>
    <thetext>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 &quot;get pixel array from Image&quot; from public GitHub.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2029748</commentid>
    <comment_count>3</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2024-04-19 02:13:01 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/27505</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2029756</commentid>
    <comment_count>4</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2024-04-19 02:34:47 -0700</bug_when>
    <thetext>For my M1, 500x500 image -&gt; imageData is
3000 for willReadFrequently = true
2000 for willReadFrequently = false</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2029758</commentid>
    <comment_count>5</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2024-04-19 02:42:12 -0700</bug_when>
    <thetext>Drawing 7x500x500, both are the same (2000).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030086</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-04-21 07:41:24 -0700</bug_when>
    <thetext>Committed 277792@main (30489f57ba19): &lt;https://commits.webkit.org/277792@main&gt;

Reviewed commits have been landed. Closing PR #27505 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>