aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl
diff options
context:
space:
mode:
authorJohannes Schickel2015-05-20 00:08:42 +0200
committerJohannes Schickel2015-05-20 00:27:23 +0200
commited698701d76f055b035f4b7fef0ed0d88d0374da (patch)
treed8862b71c76f74d2be84726fb0227cec268b595c /backends/graphics/surfacesdl
parenta709596b48b93e46b36f2142f6d781a5198fe8a2 (diff)
downloadscummvm-rg350-ed698701d76f055b035f4b7fef0ed0d88d0374da.tar.gz
scummvm-rg350-ed698701d76f055b035f4b7fef0ed0d88d0374da.tar.bz2
scummvm-rg350-ed698701d76f055b035f4b7fef0ed0d88d0374da.zip
SDL: Fix compilation with SDL2.
Diffstat (limited to 'backends/graphics/surfacesdl')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index d74a6082e3..9cb14525ee 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -125,6 +125,8 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
_hwscreen(0),
#if SDL_VERSION_ATLEAST(2, 0, 0)
_renderer(nullptr), _screenTexture(nullptr),
+#else
+ _originalBitsPerPixel(0),
#endif
_screen(0), _tmpscreen(0),
#ifdef USE_RGB_COLOR
@@ -144,7 +146,6 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
#ifdef USE_SDL_DEBUG_FOCUSRECT
_enableFocusRectDebugCode(false), _enableFocusRect(false), _focusRect(),
#endif
- _originalBitsPerPixel(0),
_transactionMode(kTransactionNone) {
// allocate palette storage
@@ -797,12 +798,14 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
_hwscreen = g_eventRec.getSurface(_videoMode.hardwareWidth, _videoMode.hardwareHeight);
} else
#endif
- {
+ {
// Save the original bpp to be able to restore the video mode on unload
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
if (_originalBitsPerPixel == 0) {
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
_originalBitsPerPixel = videoInfo->vfmt->BitsPerPixel;
}
+#endif
_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
_videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
@@ -937,10 +940,12 @@ void SurfaceSdlGraphicsManager::unloadGFXMode() {
#endif
DestroyScalers();
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
// Reset video mode to original
// This will ensure that any new graphic manager will use the initial BPP when listing available modes
if (_originalBitsPerPixel != 0)
SDL_SetVideoMode(_videoMode.screenWidth, _videoMode.screenHeight, _originalBitsPerPixel, _videoMode.fullscreen ? (SDL_FULLSCREEN | SDL_SWSURFACE) : SDL_SWSURFACE);
+#endif
}
bool SurfaceSdlGraphicsManager::hotswapGFXMode() {