aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorD G Turner2019-08-15 16:26:53 +0100
committerD G Turner2019-08-15 16:26:53 +0100
commit54c465ef17adeb7ecebdc8b9d3573e772437d034 (patch)
tree6af9ea2d44abf2a525e0d0e517576b4b98127318 /backends
parent089c04f6f7a13d40db1e5df5829e84c9a728371f (diff)
downloadscummvm-rg350-54c465ef17adeb7ecebdc8b9d3573e772437d034.tar.gz
scummvm-rg350-54c465ef17adeb7ecebdc8b9d3573e772437d034.tar.bz2
scummvm-rg350-54c465ef17adeb7ecebdc8b9d3573e772437d034.zip
BACKENDS: Fix GCC Warnings in Surface SDL Graphics
This removes the usage of memset to clear complex structures and replaces them with constructor methods for the structures which will be executed when these are instantiated.
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp6
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h41
2 files changed, 40 insertions, 7 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index bd430e8171..4b4f218caf 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -171,8 +171,6 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
_mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
- memset(&_mouseCurState, 0, sizeof(_mouseCurState));
-
_graphicsMutex = g_system->createMutex();
#ifdef USE_SDL_DEBUG_FOCUSRECT
@@ -180,10 +178,6 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
_enableFocusRectDebugCode = ConfMan.getBool("use_sdl_debug_focusrect");
#endif
- memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
- memset(&_videoMode, 0, sizeof(_videoMode));
- memset(&_transactionDetails, 0, sizeof(_transactionDetails));
-
#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && defined(USE_SCALERS)
_videoMode.mode = GFX_DOUBLESIZE;
_videoMode.scaleFactor = 2;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 3bf0dd516f..f5edd160f9 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -241,6 +241,20 @@ protected:
#ifdef USE_RGB_COLOR
bool formatChanged;
#endif
+
+ TransactionDetails() {
+ sizeChanged = false;
+ needHotswap = false;
+ needUpdatescreen = false;
+
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ needTextureUpdate = false;
+ needDisplayResize = false;
+#endif
+#ifdef USE_RGB_COLOR
+ formatChanged = false;
+#endif
+ }
};
TransactionDetails _transactionDetails;
@@ -251,7 +265,7 @@ protected:
bool aspectRatioCorrection;
AspectRatio desiredAspectRatio;
bool filtering;
-
+
#if SDL_VERSION_ATLEAST(2, 0, 0)
int stretchMode;
#endif
@@ -265,6 +279,31 @@ protected:
#ifdef USE_RGB_COLOR
Graphics::PixelFormat format;
#endif
+
+ VideoState() {
+ setup = false;
+ fullscreen = false;
+ aspectRatioCorrection = false;
+ // desiredAspectRatio set to (0, 0) by AspectRatio constructor
+ filtering = false;
+
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ stretchMode = 0;
+#endif
+
+ mode = 0;
+ scaleFactor = 0;
+
+ screenWidth = 0;
+ screenHeight = 0;
+ overlayWidth = 0;
+ overlayHeight = 0;
+ hardwareWidth = 0;
+ hardwareHeight = 0;
+#ifdef USE_RGB_COLOR
+ // format set to 0 values by Graphics::PixelFormat constructor
+#endif
+ }
};
VideoState _videoMode, _oldVideoMode;