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 #7950: Incorrect setup of Normal Screenshot ViewPort #7959

Merged
merged 2 commits into from Jan 26, 2020

Conversation

@JMcKiern
Copy link
Contributor

JMcKiern commented Jan 25, 2020

As described in #7950, selecting a Normal Screenshot would sometimes incorrectly result in the "Huge Screenshot" dialog box being shown. The dialog box would present the resolution that would be used for a default zoom screenshot even though this would not match the actual screenshot's resolution.

This pr fixes #7950 by adding handling of SC_VIEWPORT (and SC_CRASHLOG for completeness) into SetupScreenshotViewport().

Note that I don't understand all the intricacies associated with ViewPorts. Currently the ScreenshotWindow::TakeScreenshot() is the only place where SetupScreenshotViewport() is used with t == SC_VIEWPORT. So, the only properties of the viewport that currently matter in this context are the width and height. I've included the others, with what I think are appropriate values, but I may have made a mistake with these.

Copy link
Contributor

glx22 left a comment

I think it would be better to use switch instead of if cascade

@glx22 glx22 dismissed their stale review Jan 26, 2020

It's easier to read now :)

@JMcKiern
Copy link
Contributor Author

JMcKiern commented Jan 26, 2020

Yeah, you're right :)

@LordAro LordAro merged commit 2158e26 into OpenTTD:master Jan 26, 2020
8 checks passed
8 checks passed
Commit checker
Details
OpenTTD CI Build #20200126.1 succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.9) Linux linux-amd64-clang-3.9 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
@JMcKiern JMcKiern deleted the JMcKiern:fix-huge-sc-warning branch Jan 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.