-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
Improve overlay rendering for DPI scaling #2073
base: master
Are you sure you want to change the base?
Improve overlay rendering for DPI scaling #2073
Conversation
Thanks! Just an observation from the screenshots, it looks like the stroke diameter gets smaller and smaller but should be rounded to the nearest pixel scale. |
I have a question while implementing this. Is it necessary to change the size of the Overlay Canvas based on DPR (Device Pixel Ratio)? I thought that simply increasing the physical pixel count of the Overlay Canvas would result in a clearer overlay, but this creates size and position discrepancies with the regular canvas. |
I don't recall off-hand if that is necessary but it could be worth attempting. I'll delegate that to you as a research/experiment and I can code review it afterwards to sanity check. If you get really stuck on that, I can try to find a bit of time to help research it. |
Thanks! What I tried was simply converting logical pixels to physical pixels on the canvas and applying the scale in the context. Edit: When running in the development environment, I noticed a "Snap candidate overflow" occurring at I’m attaching a video of the overlay canvas with physical pixels applied. resize.mov |
Applying physical pixels did not result in noticeable rendering differences, and I also identified an issue with inaccuracies occurring during the Given this, I concluded that applying physical pixels does not provide substantial improvements to the project and could add unnecessary complexity from a maintenance perspective. Therefore, I have determined that applying physical pixels is not necessary at this stage. Thank you for giving me the time to review this. |
I will try to dive into the details of this in a couple weeks when I have time. Unfortunately the issue hasn't been the most pressing for me, since I run a monitor with 100% display scaling, so it's been difficult to prioritize so far. Sorry about that! I appreciate your attention towards this task even though I've somewhat neglected it. It would also be helpful if you could summarize the current state of things, and your research into the prior questions, so I can have the necessary context once I return to this. Thank you! |
OK, Please take all the time you need. Let me summarize our progress so far:
Additionally, the code for the overlay canvas with physical pixels applied has not yet been removed. |
!build |
|
Is this something that would make sense to break out into its own PR for a swifter merge process? Do I understand it correct that it fixes a bug that can arise in today's editor in certain scenarios? I tested the build link above with 150% scaling and it doesn't seem to avoid the antialiasing fuzziness in the simple case of drawing a rectangle and viewing its transform cage overlay, which means unfortunately this isn't really working in its desired way. I'm not sure how much bandwidth I'll have to put towards this in the near future, but merging separate parts of it that are of value, such as the quoted number 3 above, would make sense in the short term. |
Fixes #1688
Changes
Apply the following changes to the overlay using
device_pixel_ratio
:Preview
dpr 1
dpr 2
dpr 3