Transfers the data of one canvas element to another.
(source: HTMLCanvasElement, clone: HTMLCanvasElement)
| 71 | |
| 72 | /** Transfers the data of one canvas element to another. */ |
| 73 | function transferCanvasData(source: HTMLCanvasElement, clone: HTMLCanvasElement) { |
| 74 | const context = clone.getContext('2d'); |
| 75 | |
| 76 | if (context) { |
| 77 | // In some cases `drawImage` can throw (e.g. if the canvas size is 0x0). |
| 78 | // We can't do much about it so just ignore the error. |
| 79 | try { |
| 80 | context.drawImage(source, 0, 0); |
| 81 | } catch {} |
| 82 | } |
| 83 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…