-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Adjust StyleBoxFlat antialiasing to account for 2D stretch scale #92997
base: master
Are you sure you want to change the base?
Adjust StyleBoxFlat antialiasing to account for 2D stretch scale #92997
Conversation
935cc8e
to
baf7ee9
Compare
If this pr changes aa_size rendering offsets, perhaps it could/will also fix this old bug with incorrect offset of AA size on downscaled stylebox corner radius: #68514 . Just set a corner radius larger than size/2 and you should see it. It should probably be less noticeable if the aa offset is now based on display scale, but it'd be nice to get rid of it all together. |
I don't know if this is down to the focus outline having a different corner radius than the button, or whether this is a consequence of the issue I mentioned in the PR's description:
|
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.
Works as expected and code looks fine too. Nice work!
baf7ee9
to
7db69a9
Compare
This prevents the antialiasing feather from becoming too wide at viewport sizes higher than the default, which can lead to blurry visuals. This is adjusted to account for the 2D scale factor returned on the root Window, so it takes both the `canvas_items` scaling and `content_scale_factor` into account.
7db69a9
to
b43c47d
Compare
This prevents the antialiasing feather from becoming too wide at viewport sizes higher than the default, which can lead to blurry visuals.
This is adjusted to account for the 2D scale factor returned on the root Window, so it takes both the
canvas_items
scaling andcontent_scale_factor
into account.In terms of performance, the added calls take less than 1 microsecond in a debug editor build, so it's unlikely to amount to anything significant.
Line2D antialiasing can also benefit from the same technique (which could be done in a separate PR).
In the future, we can use the same opportunity to adjust corner detail based on this scale factor. This will require adjusting corner detail in the default project theme to work optimally though (i.e. without having too many triangles at high resolutions), so it's probably worth doing that in its own PR.
Other than antialiasing, the visual appearance of corners should remain as close as possible as before. Right now, border corners seem a bit less wide than before at high resolutions – I'm not sure why. I've tried to use
aa_size
instead ofaa_size_scaled
in the places that usegrow()
but it didn't look exactly right. @davthedev Any ideas?Testing projects:
Preview
Both projects use a base window size of 1152×648, but the screenshots were taken at 3840×2160 resolution. For an accurate comparison, view these images at 1:1 size by opening them in a new tab.
At the original window size, the result is 100% identical to before.