Wrong scaling factor on some iPhones

20 views
Skip to first unread message

Guillermo Rodriguez Garcia

unread,
Apr 1, 2019, 9:56:44 AM4/1/19
to PlayN
Hi all,

I just opened an issue describing a problem with the scaling factor in some iPhone devices: https://github.com/playn/playn/issues/78

The problem shows up on devices that do hardware downscaling (iPhone 6+/6s+/7+/8+). Looks like the scaling factor is off (a bit too large)

A similar issue happens on devices that support "zoomed display mode" (this was introduced by Apple with iPhone 6, and removed in iPhone X). When zoomed display mode is enabled, the scaling factor is also off (a bit too small in this case)

To make things fun, none of the two problems can be reproduced in the simulator.
 - The first problem only happens when running on a real device; in the simulator everything looks fine.
 - The second problem only happens when "zoomed display mode" is enabled. This is done via the iPhone settings app, but that setting is not available in the simulator.

I'm digging into this and working on a fix.

Best,

Guillermo

Guillermo Rodriguez Garcia

unread,
Apr 1, 2019, 10:29:22 AM4/1/19
to PlayN
OK, the issue can be fixed if we switch RoboGraphics to use UIScreen.nativeScale instead of scale. This is only available starting with iOS 8.


There's not a lot of information about this out there, and most of the existing information say something along the lines of "you should not be worrying about this unless you're doing some pretty low level stuff". So I guess we're doing low level stuff.

This same issue was also found and fixed by libgdx some time ago: https://github.com/libgdx/libgdx/issues/2356 . The current libgdx code also uses nativeScale if available.

Here is some evidence on why the problem will not show up when running in the simulator: https://twitter.com/olebegemann/status/514359847731871744

Here is an interesting discussion of "rendered pixels" vs "physical pixels". It also mentions that nativeScale is affected by "zoomed display mode": https://stackoverflow.com/a/41661445/450398 

The actual "rendered pixels" and "physical pixels" terms probably come from this site: https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions

On my side: I can confirm that the proposed PR fixes the problem for me (not only for the simplified test case, also for the actual app)

BR,

Guillermo

Michael Bayne

unread,
Apr 1, 2019, 9:11:50 PM4/1/19
to pl...@googlegroups.com
Thanks for digging into this! They keep coming up with new ways to scale pixels and make life even more complicated.

--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to playn+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Reply all
Reply to author
Forward
0 new messages