(To be clear I don't think this is very important, but I wrote a test case so I wanted to share it here - maybe someday it will matter enough to someone to iron out.)
transferToImageBitmap() can be called on OffscreenCanvases which are actually on-screen via transferControlToOffscreen(). Thus the compositor and transferToImageBitmap() can both try to take frames from the canvas.
It's probably not tested that preserveDrawingBuffer doesn't apply to transferToImageBitmap (chrome gets this wrong)
It's unclear what should happen when calling transferToImageBitmap on a canvas that has preserveDrawingBuffer: falseafter it has been presented (get the presented canvas's contents? get nothing and clear the presented canvas? get nothing but leave up the presented canvas?)
Should transferToImageBitmap() really work at all with transferControlToOffscreen()? Would be curious to see if any websites do that.
BTW in various browsers some of the canvas images will eventually "expire" if left in the background for long enough, which AFAIU is intended to be allowed with preserveDrawingBuffer: false but maybe not otherwise.
Tangentially, the sample also shows that Safari doesn't obey alpha: false on "2d"transferControlToOffscreen contexts - don't know if this is a known issue.
(To be clear I don't think this is very important, but I wrote a test case so I wanted to share it here - maybe someday it will matter enough to someone to iron out.)
transferToImageBitmap()
can be called onOffscreenCanvas
es which are actually on-screen viatransferControlToOffscreen()
. Thus the compositor andtransferToImageBitmap()
can both try to take frames from the canvas.Here's a sample page: https://codepen.io/kainino0x/pen/dyxoNRd
It raises issues like:
preserveDrawingBuffer
doesn't apply totransferToImageBitmap
(chrome gets this wrong)transferToImageBitmap
on a canvas that haspreserveDrawingBuffer: false
after it has been presented (get the presented canvas's contents? get nothing and clear the presented canvas? get nothing but leave up the presented canvas?)transferToImageBitmap()
really work at all withtransferControlToOffscreen()
? Would be curious to see if any websites do that.BTW in various browsers some of the canvas images will eventually "expire" if left in the background for long enough, which AFAIU is intended to be allowed with
preserveDrawingBuffer: false
but maybe not otherwise.See also #3612, #3615