-
-
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
Replace pixel rounding with floor(x + 0.5)
#93740
Replace pixel rounding with floor(x + 0.5)
#93740
Conversation
Thanks for making the PR. I was also looking at this more in-depth locally, and noticed godot/scene/gui/rich_text_label.cpp Line 1252 in 25de53e
snap_2d_transforms_to_pixel .
I do also have to note that, I realized there is a very specific edge case: the value Finally, there is the question whether we should do the same for GUI |
Ah, yeah. I think that has always been rounded, which is why we never changed it. |
468ac51
to
6b17d51
Compare
Did you try if it works with @KeyboardDanni's test scene found in #84380? |
@adamscott Yep. Same result. |
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.
Testing some games, all seems right. Tested out the issue MRP and it fixes it as well. Let's go, then?
Thanks! |
Instead of replacing round(x) with floor(x + 0.5), wouldn't it be better to replace round(x) with round(x + FLOAT_EPSILON)? (being FLOAT_EPSILON (I don't know it if is allowed to comment closed pull requests or issues. If it is not allowed, please forgive me.) |
I'm not quite sure what epsilon would do for us here. Epsilon is generally used when comparing equality between two floating point numbers, not flooring or rounding. Even there, epsilon is a bit of a flawed concept, because the "minimum distance between two numbers" is different based on the current exponent. |
Seems like it's cause a serious regression: #94298 |
Fixes: #93731
We should do some more testing to be sure this has no side effects in pixel perfect art projects.