[Scummvm-git-logs] scummvm master -> 54c465ef17adeb7ecebdc8b9d3573e772437d034

digitall dgturner at iee.org
Thu Aug 15 17:30:09 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
54c465ef17 BACKENDS: Fix GCC Warnings in Surface SDL Graphics


Commit: 54c465ef17adeb7ecebdc8b9d3573e772437d034
    https://github.com/scummvm/scummvm/commit/54c465ef17adeb7ecebdc8b9d3573e772437d034
Author: D G Turner (digitall at scummvm.org)
Date: 2019-08-15T16:26:53+01:00

Commit Message:
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.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index bd430e8..4b4f218 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 3bf0dd5..f5edd16 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;
 





More information about the Scummvm-git-logs mailing list