Changeset - r24064:43be4bdad6bc
[Not reviewed]
master
0 1 0
JMcKiern - 4 years ago 2020-01-18 22:05:51
jmckiern@tcd.ie
Fix #7927: Incorrect resolution shown in "Huge screenshot" query window. (#7949)
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/screenshot_gui.cpp
Show inline comments
 
@@ -5,24 +5,25 @@
 
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
 /** @file screenshot_gui.cpp GUI functions related to screenshots. */
 

	
 
#include "stdafx.h"
 
#include "gui.h"
 
#include "viewport_func.h"
 
#include "window_func.h"
 
#include "window_gui.h"
 
#include "screenshot.h"
 
#include "textbuf_gui.h"
 
#include "strings_func.h"
 

	
 
#include "widgets/screenshot_widget.h"
 

	
 
#include "table/strings.h"
 

	
 
static ScreenshotType _screenshot_type;
 

	
 
struct ScreenshotWindow : Window {
 
	ScreenshotWindow(WindowDesc *desc) : Window(desc) {
 
		this->CreateNestedTree();
 
		this->FinishInitNested();
 
	}
 
@@ -48,24 +49,26 @@ struct ScreenshotWindow : Window {
 

	
 
	/**
 
	 * Make a screenshot.
 
	 * Ask for confirmation if the screenshot will be huge.
 
	 * @param t Screenshot type: World, defaultzoom, heightmap or viewport screenshot
 
	 */
 
	static void TakeScreenshot(ScreenshotType st) {
 
		ViewPort vp;
 
		SetupScreenshotViewport(st, &vp);
 
		if ((uint64)vp.width * (uint64)vp.height > 8192 * 8192) {
 
			/* Ask for confirmation */
 
			_screenshot_type = st;
 
			SetDParam(0, vp.width);
 
			SetDParam(1, vp.height);
 
			ShowQuery(STR_WARNING_SCREENSHOT_SIZE_CAPTION, STR_WARNING_SCREENSHOT_SIZE_MESSAGE, nullptr, ScreenshotConfirmationCallback);
 
		}
 
		else {
 
			/* Less than 64M pixels, just do it */
 
			MakeScreenshot(st, nullptr);
 
		}
 
	}
 

	
 
	/**
 
	 * Callback on the confirmation window for huge screenshots.
 
	 * @param w Window with viewport
 
	 * @param confirmed true on confirmation
0 comments (0 inline, 0 general)