Skip to content
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

Fix viewport attach position when forced integer stretch scale of 1 makes it bigger than window #91787

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kleonc
Copy link
Member

@kleonc kleonc commented May 10, 2024

Fixes #89578.
Supersedes #90257.

vBZrrso3gT TmsHhpSyAO o7v4NNcJJ8 nPSywsAOqf

Haven't dived deep into the code (looked only into Window::_update_viewport_size) so please test thoroughly. Firstly I've tried just adding a proper offset to the margin, it resulted in the opposite issue compared to #89578 (comment):

kQEXwsbmYt

Then I've noticed margin is also applied to window_transform, hence tried a separate additional offset just for attach_to_screen_rect. And that's this PR, seems to work. 🙃

@kleonc kleonc added this to the 4.3 milestone May 10, 2024
@kleonc kleonc requested a review from Sauermann May 10, 2024 06:57
@kleonc kleonc requested a review from a team as a code owner May 10, 2024 06:57
Comment on lines -1142 to -1151
Size2 offset;

if (screen_size.x < video_mode.x) {
margin.x = Math::round((video_mode.x - screen_size.x) / 2.0);
offset.x = Math::round(margin.x * viewport_size.y / screen_size.y);
}

if (screen_size.y < video_mode.y) {
margin.y = Math::round((video_mode.y - screen_size.y) / 2.0);
offset.y = Math::round(margin.y * viewport_size.x / screen_size.x);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This offset was unused, hence removing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect work of look_at function
1 participant