Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify/test transferToImageBitmap() on on-screen canvases #3695

Open
kainino0x opened this issue Sep 28, 2024 · 1 comment
Open

Clarify/test transferToImageBitmap() on on-screen canvases #3695

kainino0x opened this issue Sep 28, 2024 · 1 comment

Comments

@kainino0x
Copy link
Contributor

(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.

Here's a sample page: https://codepen.io/kainino0x/pen/dyxoNRd

It raises issues like:

  • 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: 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?)
  • 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.

See also #3612, #3615

@kainino0x
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant