You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the system has a scaled retina mode active, (e.g. system preferences -> display -> resolution (scaled) -> Larger Text), SDL_GetCurrentDisplayMode was returning width/height in points, not pixels.
Afaik, we want it to always return pixels (I also updated the comments in the SDL_DisplayMode struct to clarify that the units are pixels).
This patch is just using the CGDisplayModeGetPixelWidth/Height introduced in 10.8, instead of CGDisplayModeGetWidth/Height as before.
There is a runtime check as well as a preprocessor check so we can still compile on 10.7 (although, it would be safer to drop support for compiling on 10.7, since a build made on 10.7 would lack the bug fix if it were run on 10.8+.)
To reproduce the issue, set the "Larger Text" scaling mode in system preferences, on a retina display. Run testdraw2 with "--info all".
Without this patch:
INFO: Bounds: 1024x640 at 0,0
INFO: Usable bounds: 1003x618 at 0,0
INFO: DPI: 78.500000x78.500000
INFO: Current mode: 1024x640@60Hz, 32 bits-per-pixel (SDL_PIXELFORMAT_ARGB8888)
With this patch:
INFO: Bounds: 1024x640 at 0,0
INFO: Usable bounds: 1003x618 at 0,0
INFO: DPI: 78.500000x78.500000
INFO: Current mode: 2048x1280@60Hz, 32 bits-per-pixel (SDL_PIXELFORMAT_ARGB8888)
On 2017-07-12 20:24:30 +0000, Alex Szpakowski wrote:
(In reply to Eric Wasylishen from comment # 0)
When the system has a scaled retina mode active, (e.g. system preferences ->
display -> resolution (scaled) -> Larger Text), SDL_GetCurrentDisplayMode
was returning width/height in points, not pixels.
Afaik, we want it to always return pixels (I also updated the comments in
the SDL_DisplayMode struct to clarify that the units are pixels).
SDL display modes are intentionally in points rather than pixels. It would be handy to have additional fields in the struct for pixel dimensions, though
SDL window positions and dimensions are also in points rather than pixels (SDL_GL_GetDrawableSize and SDL_GetRendererOutputSize are the only two functions that explicitly return pixel dimensions, in SDL). So the coordinate space of display modes should match that of window sizes, right now.
On 2017-07-12 23:20:46 +0000, Eric Wasylishen wrote:
Ah, I see. The reason I was thinking the width/height of the SDL_DisplayMode struct had to be pixels, is the fact that the window is stretched to fill the screen means the points part of the high-DPI equation cancels out.
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
Reported in version: HG 2.1
Reported for operating system, platform: Other, x86
Comments on the original bug report:
On 2017-07-12 19:05:30 +0000, Eric Wasylishen wrote:
On 2017-07-12 20:24:30 +0000, Alex Szpakowski wrote:
On 2017-07-12 23:20:46 +0000, Eric Wasylishen wrote:
On 2017-07-13 00:31:09 +0000, Alex Szpakowski wrote:
The text was updated successfully, but these errors were encountered: