summaryrefslogtreecommitdiff
path: root/src/resources/sdlscreenshothelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-16 01:03:19 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-16 01:03:19 +0300
commit78fb544aeb8761e8d554487487bc27e610822e2d (patch)
tree45ec42f5dcba94cd391f54a4cef2c017d7318d38 /src/resources/sdlscreenshothelper.cpp
parentfcdc44b21bda79052205ca1884b7f3a1ebd32957 (diff)
downloadmanaplus-78fb544aeb8761e8d554487487bc27e610822e2d.tar.gz
manaplus-78fb544aeb8761e8d554487487bc27e610822e2d.tar.bz2
manaplus-78fb544aeb8761e8d554487487bc27e610822e2d.tar.xz
manaplus-78fb544aeb8761e8d554487487bc27e610822e2d.zip
Use screenshort helpers for creating screenshots
Diffstat (limited to 'src/resources/sdlscreenshothelper.cpp')
-rw-r--r--src/resources/sdlscreenshothelper.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/resources/sdlscreenshothelper.cpp b/src/resources/sdlscreenshothelper.cpp
index f194f93ed..eff32e303 100644
--- a/src/resources/sdlscreenshothelper.cpp
+++ b/src/resources/sdlscreenshothelper.cpp
@@ -39,14 +39,15 @@ SdlScreenshotHelper::~SdlScreenshotHelper()
{
}
-void SdlScreenshotHelper::prepare(const int width A_UNUSED,
- const int height A_UNUSED)
+void SdlScreenshotHelper::prepare()
{
}
-SDL_Surface *SdlScreenshotHelper::getScreenshot(const int width,
- const int height)
+SDL_Surface *SdlScreenshotHelper::getScreenshot()
{
+ if (!mainGraphics)
+ return nullptr;
+
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int rmask = 0xff000000;
const int gmask = 0x00ff0000;
@@ -59,7 +60,7 @@ SDL_Surface *SdlScreenshotHelper::getScreenshot(const int width,
const int amask = 0x00000000;
SDL_Surface *const screenshot = MSDL_CreateRGBSurface(SDL_SWSURFACE,
- width, height,
+ mainGraphics->mWidth, mainGraphics->mHeight,
24,
rmask, gmask, bmask, amask);