Maelstrom: Fixed scaling for screenshots (uses real window size, not logical coordinates)

https://github.com/libsdl-org/Maelstrom/commit/3b50ecba2fb4d05f1daa458efaa18d2ca3015a19

From 3b50ecba2fb4d05f1daa458efaa18d2ca3015a19 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 25 Feb 2013 01:03:14 -0800
Subject: [PATCH] Fixed scaling for screenshots (uses real window size, not
 logical coordinates)

---
 screenlib/SDL_FrameBuf.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/screenlib/SDL_FrameBuf.cpp b/screenlib/SDL_FrameBuf.cpp
index 3822c42d..09378b15 100644
--- a/screenlib/SDL_FrameBuf.cpp
+++ b/screenlib/SDL_FrameBuf.cpp
@@ -328,12 +328,24 @@ FrameBuf::Fade(void)
 int
 FrameBuf::ScreenDump(const char *prefix, int x, int y, int w, int h)
 {
+	float scale_x, scale_y;
 	SDL_Rect rect;
 	SDL_Surface *dump;
 	int which, found;
 	char file[1024];
 	int retval;
 
+	if (!w) {
+		w = Width();
+	}
+	if (!h) {
+		h = Height();
+	}
+	SDL_RenderGetScale(renderer, &scale_x, &scale_y);
+
+	w = (int)(w * scale_x);
+	h = (int)(h * scale_y);
+
 	/* Create a BMP format surface */
 	dump = SDL_CreateRGBSurface(0, w, h, 24, 
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
@@ -347,12 +359,6 @@ FrameBuf::ScreenDump(const char *prefix, int x, int y, int w, int h)
 	}
 
 	/* Read the screen into it */
-	if (!w) {
-		w = Width();
-	}
-	if (!h) {
-		h = Height();
-	}
 	rect.x = x;
 	rect.y = y;
 	rect.w = w;