From 54c465ef17adeb7ecebdc8b9d3573e772437d034 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 15 Aug 2019 16:26:53 +0100 Subject: 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. --- .../graphics/surfacesdl/surfacesdl-graphics.cpp | 6 ---- backends/graphics/surfacesdl/surfacesdl-graphics.h | 41 +++++++++++++++++++++- 2 files changed, 40 insertions(+), 7 deletions(-) (limited to 'backends/graphics/surfacesdl') 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; -- cgit v1.2.3