-
Notifications
You must be signed in to change notification settings - Fork 43
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
Android backend #130
base: master
Are you sure you want to change the base?
Android backend #130
Conversation
Currently the web backend converts to RGBA on present. We can do the same here, if we want to merge this before we figure out #98. Ultimately we'll want that to provide an API that lets a client enumerate supported formats (some backends may support only BGRA, only RGBA, or both, etc.). And either use a native format or provide an easy way to convert when needed. |
Adding a So that can be added to the API when #98 is implemented. |
examples/winit.rs
Outdated
use winit::window::WindowBuilder; | ||
|
||
/// Run with `cargo apk r --example winit_android` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a mention of how to run the example on webassembly in the readme: https://github.com/rust-windowing/softbuffer/#webassembly.
So a quick mention of Android there would be good.
No fuss/hurry to get this merged before fleshing out the details.
Sounds like a plan.
It's necessary unless we code in the conversion on present. And Android might again do a conversion after that. |
On Android the backing buffer (`NativeWindow`) disappears when the application is not focussed and/or the screen is locked. Winit handles this by requiring apps to create their `raw_window_handle()` consumers _after_ `Event::Resumed` and to clean it up _before_ returning from `Event::Suspended`. For consistency Winit also sends `Resumed` on all other platforms during init.
Fixes #44
Contains my hacks to further discussing Android support. There are two issues:
stride() != width()
, requiring us to deal with that (andIOSurface
on Mac seems to have the same?).These could either be solved by exposing this information to the user (more work and documentation for them, but also more performant) or kept hidden by maintaining the current API, but requiring an extra framebuffer allocation that we convert when they submit the frame.