| Summary: | When SDL_WINDOW_ALLOW_HIGHDPI is set, resize events/SDL_GetWindowSize give scaled size | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Mark Callow <libsdl.org> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | amaranth72 |
| Version: | 2.0.4 | ||
| Hardware: | x86 | ||
| OS: | macOS 10.12 | ||
|
Description
Mark Callow
2017-03-16 03:59:44 UTC
Internally SDL_SendWindowEvent sets the value reported by SDL_GetWindowSize() as well as sending the DL_WINDOWEVENT_SIZE_CHANGED event. For uikit video, this is called by uikitviewcontroller.viewDidLayoutSubviews and it passes the size of the bounds of the controller's main view. UIView bounds are always in points according to Apple's documentation. Is there a use case for reporting the size in points to an app that has requested SDL_WINDOW_ALLOW_HIGHDPI. I can't see one. (In reply to Mark Callow from comment #0) > When SDL_WINDOW_ALLOW_HIGHDPI is set, width and height in > SDL_WINDOWEVENT_SIZE_CHANGED events and returned by SDL_GetWindowSize() are > the scaled size of the window not the high DPI size of the window. This is intentional. See the readme: https://hg.libsdl.org/SDL/file/e212b4d00d84/docs/README-ios.md#l61 (In reply to Mark Callow from comment #1) > Is there a use case for reporting the size in points to an app that has requested SDL_WINDOW_ALLOW_HIGHDPI. I can't see one. Yes. Apps should almost exclusively be using the point size and not the pixel size (except for render target sizes and explicitly *per-pixel* information/operations such as shader fragment coordinates). This is what users of high-DPI apps will expect, because this is how they appear at a consistent size across devices with different DPI scale factors. Thanks Alex. I might be able to retrieve the pixel size from the Vulkan surface. I'll check. If not, I will have to add another API to return the pixel size of the Vulkan/Metal surface attached to an SDL_window and probably some field(s) in SDL_window to store the information. |