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

SDL_GetWindowDisplayMode/SDL_GetWindowSize returning incorrect result on iPhone 8 Plus #3220

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.1
Reported for operating system, platform: iOS 11, iPhone/iPod touch

Comments on the original bug report:

On 2019-04-03 20:00:14 +0000, Dan Ginsburg wrote:

I'm running on an iPhone 8 Plus on iOS 12.2. For review here are its display values for the iPhone 8 Plus (from https://developer.apple.com/library/archive/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/Displays/Displays.html#//apple_ref/doc/uid/TP40013599-CH108-SW2)

nativeBounds (Pixels): 1080x1920
UIKit Size (Points): 414x736
nativeScaleFactor (not Zoomed): 2.608
scale (UIKit Scale Factor): 3

What happens is that in UIKIt_GetDisplayModes:

uimode.size.width = 1242
uimode.size.height = 2208

This is the UIKit Size (414x736) times the UIKitScale factor (3).

I expect the mode to be returned in points, which should be 414x736. However, it instead returns 476x846 [1242x2208]/2.608. The reason it does this is because of this code:

#ifdef __IPHONE_8_0
/* The UIScreenMode of an iPhone 6 Plus should be 1080x1920 rather than
* 1242x2208 (414x736@3x), so we should use the native scale. */
if ([data.uiscreen respondsToSelector:@selector(nativeScale)]) {
scale = data.uiscreen.nativeScale;
}
#endif

If I remove that code from UIKit_GetDisplayModes, it returns the correct values.

That code has been there since this commit:

https://hg.libsdl.org/SDL/rev/dbe19a0cad97

The change that commit made to SDL_uikitopengles.m makes sense to me, but I'm not sure why the change to UIKit_GetDisplayModes was made. I'd propose to delete the code from UIKit_GetDisplayModes, but I'm not sure if there was something that was counting on it.

On 2019-05-18 18:48:54 +0000, Ryan C. Gordon wrote:

Tagging a bunch of bugs with "target-2.0.10" so we have a clear list of things to address before a 2.0.10 release.

Please note that "addressing" one of these bugs might mean deciding to defer on it until after 2.0.10, or resolving it as WONTFIX, etc. This is just here to tell us we should look at it carefully, and soon.

If you have new information or feedback on this issue, this is a good time to add it to the conversation, as we're likely to be paying attention to this specific report in the next few days/weeks.

Thanks!

--ryan.

On 2019-05-26 21:59:29 +0000, Alex Szpakowski wrote:

This was fixed by https://hg.libsdl.org/SDL/rev/c9410703cbdd

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