| OLD | NEW |
| 1 self.onmessage = function(e) { | 1 self.onmessage = function(e) { |
| 2 // Worker does two things: | 2 // Worker does two things: |
| 3 // 1. call createImageBitmap() from the ImageBitmap that is transferred | 3 // 1. call createImageBitmap() from the ImageBitmap that is transferred |
| 4 // from the main thread, which verifies that createImageBitmap(ImageBitmap) | 4 // from the main thread, which verifies that createImageBitmap(ImageBitmap) |
| 5 // works on the worker thread. | 5 // works on the worker thread. |
| 6 // 2. send the created ImageBitmap back to the main thread, the | 6 // 2. send the created ImageBitmap back to the main thread, the |
| 7 // main thread exam the property of this ImageBitmap to make sure | 7 // main thread exam the property of this ImageBitmap to make sure |
| 8 // the transfer between main and worker thread didn't lose data | 8 // the transfer between main and worker thread didn't lose data |
| 9 createImageBitmap(e.data.data).then(imageBitmap => { | 9 createImageBitmap(e.data.data, {colorSpaceConversion: "none"}).then(imageBitma
p => { |
| 10 postMessage({data: imageBitmap}, [imageBitmap]); | 10 postMessage({data: imageBitmap}, [imageBitmap]); |
| 11 }); | 11 }); |
| 12 }; | 12 }; |
| OLD | NEW |