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

Surface::configure() should resize canvas #3620

Closed
daxpedda opened this issue Mar 26, 2023 · 0 comments · Fixed by #3690
Closed

Surface::configure() should resize canvas #3620

daxpedda opened this issue Mar 26, 2023 · 0 comments · Fixed by #3690

Comments

@daxpedda
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The problem is rust-windowing/winit#2733:

I am using transferControlToOffscreen() to draw in a different thread, which unfortunately invalidates any calls to width() and height().

While trying to figure out how this could be fixed in winit, I got the idea that maybe this shouldn't be winits problem after all. Setting the width and height of the canvas doesn't actually resize the canvas visually, it only resizes the surface the canvas is drawing on (the browser stretches or compresses the surface to fit the visual canvas size), which sounds like it would be the job of the renderer, not the window handler. Currently winit does both, changing the visual size of the canvas and it's surface.

Describe the solution you'd like
Surface::configure() gets passed the size anyway, it would then use width() and height() to resize the canvas as well.
This is what softbuffer does as well (src).

Describe alternatives you've considered
The alternative is to fix it in winit, which would require additional awareness by winit about what is done to the canvas to render to it.

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

Successfully merging a pull request may close this issue.

1 participant