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.
This commit is contained in:
D G Turner
2019-08-15 16:26:53 +01:00
parent 089c04f6f7
commit 54c465ef17
2 changed files with 40 additions and 7 deletions
@@ -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;
@@ -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;