-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix MacOS retina support #2
Conversation
Can you elaborate on what this means? Do you mean the resolution or the scaling factor? |
Ok, this mostly works, but the screen will freak out when, very specifically: launching with a scale factor of 2, switching to a scale factor of 1, switching back to 2. The screen will flicker until the client is resized or the GPU plugin toggled. Someone more familiar with this code should take a look, this was way more than I planned on doing. 😄 |
Okay, I think this is done now. The flickering was because only one buffer was getting resized, and I'm now getting the current window's scale factor via AWT so it'll update when dragging between monitors etc. |
Have you looked at either https://developer.apple.com/documentation/quartzcore/calayer/1410801-rasterizationscale?language=objc or https://developer.apple.com/documentation/quartzcore/calayer/1410746-contentsscale?language=objc ? You might be able to avoid the upcall to get the scale if you can just read it from the calayer. |
Yeah, we have to update that field ourselves because the layer we create isn't automatically managed by a view. |
rlawt_mac.m
Outdated
} | ||
|| IOSurfaceGetWidth(ctx->buffer[ctx->back]) != ctx->layer.frame.size.width | ||
|| IOSurfaceGetHeight(ctx->buffer[ctx->back]) != ctx->layer.frame.size.height | ||
|| ctx->backingScaleFactor != ctx->layer.superlayer.contentsScale) { |
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.
Since the scales are tied to the buffers I would probably make a CGfloat scale[2]
in AWTContext
to avoid this double-swap
This has been added in d5229d0. Note that your PR is recreating both IO surfaces each frame due to not scaling the dimensions used for the resize check. |
Ensures the IOSurfaces are created with real pixel values.
See runelite/runelite#17575