run stretch's layout on physical coordinates to fix pixel alignment#1061
Merged
cart merged 2 commits intobevyengine:masterfrom Dec 15, 2020
Merged
run stretch's layout on physical coordinates to fix pixel alignment#1061cart merged 2 commits intobevyengine:masterfrom
cart merged 2 commits intobevyengine:masterfrom
Conversation
cart
reviewed
Dec 15, 2020
Member
cart
left a comment
There was a problem hiding this comment.
This looks good to me. I can't produce any artifacts on 2x scale factors (presumably because its a whole number). I guess I'll just trust that this works :)
Contributor
Author
|
There is one artifact you can see when running a 2x scale factor. Run the UI example and watch the two elements anchored to the top edge while resizing the window from the bottom edge. They vibrate vertically due to the fractional part of logical size spinning through different values. For 2x, it would toggle between .0 and .5 which causes the items to move up and down by one pixel. |
Member
|
Ooh yeah thats definitely noticeable. And this pr definitely fixes it. Nice work! |
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the values passed to stretch's algorithm are in logical coordinates. Due to internal rounding in stretch's algorithm, the results don't align to the pixel grid on high DPI monitors with non-integer scaling factors. This patch converts those values to physical coordinates prior to invoking the stretch and converts the results back to logical coordinates so that stretch rounds coordinates to the nearest physical pixel.