-
Notifications
You must be signed in to change notification settings - Fork 51
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
Support for physical vs logical pixels #22
Comments
Softbuffer always (should always??) uses physical pixels. Your issue is that macOS is scaling the application because it doesn't know it supports HiDPI. You have to find the binary in Finder, Cmd+I on it, and uncheck "Run this app in low-resolution" (or something like that). This should be remembered across builds. The actual solution to this problem is to use something like |
I think that this should not be worked around in the application, softbuffer should apply the contents scale factor to the layer it creates as if the application rendered it by hand. I've made a PR for this. |
Use a patched version until rust-windowing/softbuffer#22 is fixed.
Absolutely, I agree. |
Use a patched version until rust-windowing/softbuffer#22 is fixed.
I pretty strongly believe that the conversion from logical to physical should happen in the consumer of |
exactly |
On macOS, the buffer is applied using logical pixels rather than physical pixels so a 100x100 buffer will fill a 100x100 (logical pixels) window even if the window occupies 200x200 (physical) pixels. A 200x200 buffer in the same scenario will just be cropped. This is a good default that makes UI easier to develop, but results in output that looks low res.
I'm currently working around this by setting my buffer to the physical pixel size, then scaling it on application by adding the following to set_buffer in cg.rs:
self.layer.set_contents_scale(width as f64 / self.layer.bounds().size.width);
I'm not sure what the right and real mechanism for doing this should be (e.g. always use physical? allow scale factor choice?)
The text was updated successfully, but these errors were encountered: