From 6e02a3cbe4c3e9faa9aab458bdf1c220eb7b4e32 Mon Sep 17 00:00:00 2001 From: ewew ukek Date: Tue, 16 Apr 2024 18:33:14 +0000 Subject: Fix screenshot size for OpenGL modes Screenshot code didn't take into account scaling setting which resulted in cropped screenshots. I didn't touch SDL modes because they don't support scaling and I'm not sure how that would be implemented for software render. **** mana/plus!70 --- src/resources/mobileopenglscreenshothelper.cpp | 12 +++++++----- src/resources/openglscreenshothelper.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/resources/mobileopenglscreenshothelper.cpp b/src/resources/mobileopenglscreenshothelper.cpp index fb0be453a..6772c8fd0 100644 --- a/src/resources/mobileopenglscreenshothelper.cpp +++ b/src/resources/mobileopenglscreenshothelper.cpp @@ -50,15 +50,17 @@ MobileOpenGLScreenshotHelper::~MobileOpenGLScreenshotHelper() void MobileOpenGLScreenshotHelper::prepare() { if (config.getBoolValue("usefbo")) - graphicsManager.createFBO(mainGraphics->mWidth, - mainGraphics->mHeight, - &mFbo); + graphicsManager.createFBO(mainGraphics->mActualWidth, + mainGraphics->mActualHeight, + &mFbo); } SDL_Surface *MobileOpenGLScreenshotHelper::getScreenshot() { - const int h = mainGraphics->mHeight; - const int w = mainGraphics->mWidth - (mainGraphics->mWidth % 4); + const int h = mainGraphics->mActualHeight; + const int w = mainGraphics->mActualWidth + -(mainGraphics->mActualWidth % 4); + GLint pack = 1; SDL_Surface *const tmpImage = MSDL_CreateRGBSurface( diff --git a/src/resources/openglscreenshothelper.cpp b/src/resources/openglscreenshothelper.cpp index b0d21e81c..975b6bd35 100644 --- a/src/resources/openglscreenshothelper.cpp +++ b/src/resources/openglscreenshothelper.cpp @@ -49,15 +49,17 @@ OpenGLScreenshotHelper::~OpenGLScreenshotHelper() void OpenGLScreenshotHelper::prepare() { if (config.getBoolValue("usefbo")) - graphicsManager.createFBO(mainGraphics->mWidth, - mainGraphics->mHeight, - &mFbo); + graphicsManager.createFBO(mainGraphics->mActualWidth, + mainGraphics->mActualHeight, + &mFbo); } SDL_Surface *OpenGLScreenshotHelper::getScreenshot() { - const int h = mainGraphics->mHeight; - const int w = mainGraphics->mWidth - (mainGraphics->mWidth % 4); + const int h = mainGraphics->mActualHeight; + const int w = mainGraphics->mActualWidth + -(mainGraphics->mActualWidth % 4); + GLint pack = 1; SDL_Surface *const screenshot = MSDL_CreateRGBSurface( -- cgit v1.2.3-70-g09d2