diff engine/core/video/devicecaps.cpp @ 653:01acc9fc35ea

* Moved getCurrentScreenMode() to the renderbackend as renderbackend is what initializes the screen. * Updated the Color masks to follow the integer standards * Added some new SDL modes (HW Surface and double buffer) to check for in DeviceCaps. * RenderBackend now saves the actual flags used to initialize the screen.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 15 Oct 2010 18:54:34 +0000
parents b9c132cb6ea4
children 5d6b1820b953
line wrap: on
line diff
--- a/engine/core/video/devicecaps.cpp	Fri Oct 15 15:13:10 2010 +0000
+++ b/engine/core/video/devicecaps.cpp	Fri Oct 15 18:54:34 2010 +0000
@@ -56,8 +56,18 @@
 		if (m_bpp < rhs.getBPP() ) {
 			return true;
 		}
+
 		else if (m_bpp == rhs.getBPP()) {
-			if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) {
+			if (m_width == rhs.getWidth() && m_height == rhs.getHeight()){
+				if (!(m_SDLFlags & SDL_HWSURFACE) && (rhs.getSDLFlags() & SDL_HWSURFACE)) {
+					//I would like return true so that we prefer hardware surfaces but
+					//it really slows the engine down in fullscreen.  See the SDL FAQ for an
+					//explanation.
+					return false;
+				}
+			}
+
+			else if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) {
 				return true;
 			}
 		}
@@ -134,7 +144,7 @@
 
 		//FLAGS
 #ifdef HAVE_OPENGL
-		const uint32_t numFlags = 4;
+		const uint32_t numFlags = 6;
 		uint32_t flags[numFlags];
 
 		//OpenGL, windowed, hw accel
@@ -143,16 +153,25 @@
 		flags[1] = ScreenMode::HW_FULLSCREEN_OPENGL;
 		//SDL, windowed
 		flags[2] = ScreenMode::WINDOWED_SDL;
+		//SDL, windowed, hw surface, double buffer
+		flags[3] = ScreenMode::WINDOWED_SDL_DB_HW;
 		//SDL, fullscreen
-		flags[3] = ScreenMode::FULLSCREEN_SDL;
+		flags[4] = ScreenMode::FULLSCREEN_SDL;
+		//SDL, fullscreen, hw surface, double buffer
+		flags[5] = ScreenMode::FULLSCREEN_SDL_DB_HW;
+
 #else
-		const uint32_tnumFlags = 2;
+		const uint32_tnumFlags = 4;
 		uint32_t flags[numFlags];
 
 		//SDL, windowed
 		flags[0] = ScreenMode::WINDOWED_SDL;
+		//SDL, windowed, hw surface, double buffer
+		flags[1] = ScreenMode::WINDOWED_SDL_DB_HW;
 		//SDL, fullscreen
-		flags[1] = ScreenMode::FULLSCREEN_SDL;
+		flags[2] = ScreenMode::FULLSCREEN_SDL;
+		//SDL, fullscreen, hw surface, double buffer
+		flags[3] = ScreenMode::FULLSCREEN_SDL_DB_HW;
 #endif
 
 		//BITS PER PIXEL