[Scummvm-cvs-logs] SF.net SVN: scummvm:[50796] scummvm/branches/gsoc2010-opengl/backends

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Sun Jul 11 06:32:24 CEST 2010


Revision: 50796
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50796&view=rev
Author:   vgvgf
Date:     2010-07-11 04:32:24 +0000 (Sun, 11 Jul 2010)

Log Message:
-----------
Moved getGraphicsManager() from OSystem_SDL to ModularBackend. Moved public SDL graphics manager functions to graphics manager (Allowing OpenGLSdlGraphicsMaanger to be used with other SDL managers easily). Removed BaseSdlGraphicsManager. Implemented in the opengl manager basic screen functions.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/graphics.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
    scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp
    scummvm/branches/gsoc2010-opengl/backends/modular-backend.h
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h

Removed Paths:
-------------
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h

Modified: scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.cpp	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/events/sdl/sdl-events.cpp	2010-07-11 04:32:24 UTC (rev 50796)
@@ -324,7 +324,7 @@
 
 	// Ctrl-Alt-<key> will change the GFX mode
 	if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
-		if (((OSystem_SDL *) g_system)->getGraphicsManager()->handleScalerHotkeys(ev.key))
+		if (((OSystem_SDL *) g_system)->getGraphicsManager()->handleScalerHotkeys((Common::KeyCode)ev.key.keysym.sym))
 			return false;
 	}
 

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/graphics.h	2010-07-11 04:32:24 UTC (rev 50796)
@@ -28,6 +28,7 @@
 
 #include "common/system.h"
 #include "common/noncopyable.h"
+#include "common/keyboard.h"
 
 /**
  * Abstract class for graphics manager. Subclasses
@@ -84,6 +85,41 @@
 	virtual void disableCursorPalette(bool disable) = 0;
 
 	virtual void displayMessageOnOSD(const char *msg) {}
+
+	/**
+	 * Marks the screen for a full redraw
+	 */
+	virtual void forceFullRedraw() {};
+
+	/**
+	 * Handles the scalar hotkeys
+	 */
+	virtual bool handleScalerHotkeys(Common::KeyCode key) { return false; };
+
+	/**
+	 * Returns if the event passed is a hotkey for the graphics scalers
+	 */
+	virtual bool isScalerHotkey(const Common::Event &event) { return false; };
+
+	/**
+	 * Adjusts mouse event coords for the current scaler
+	 */
+	virtual void adjustMouseEvent(Common::Event &event) {};
+
+	/**
+	 * Updates the mouse cursor position
+	 */
+	virtual void setMousePos(int x, int y) {};
+
+	/**
+	 * Toggles fullscreen
+	 */
+	virtual void toggleFullScreen() {};
+
+	/**
+	 * Saves a screenshot to a file
+	 */
+	virtual bool saveScreenshot(const char *filename) { return false; };
 };
 
 #endif

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-07-11 04:32:24 UTC (rev 50796)
@@ -28,7 +28,19 @@
 
 OpenGLGraphicsManager::OpenGLGraphicsManager()
 	:
-	_gameTexture(0), _overlayTexture(0), _mouseTexture(0) 	{
+	_gameTexture(0), _overlayTexture(0), _mouseTexture(0),
+	_screenChangeCount(0),
+	_transactionMode(0)
+	
+	{
+
+	memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
+	memset(&_videoMode, 0, sizeof(_videoMode));
+	memset(&_transactionDetails, 0, sizeof(_transactionDetails));
+
+	_videoMode.mode = GFX_NORMAL;
+	_videoMode.scaleFactor = 1;
+	_videoMode.fullscreen = false;
 }
 
 OpenGLGraphicsManager::~OpenGLGraphicsManager() {
@@ -93,7 +105,33 @@
 #endif
 
 void OpenGLGraphicsManager::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
+	assert(_transactionMode == kTransactionActive);
 
+#ifdef USE_RGB_COLOR
+	//avoid redundant format changes
+	Graphics::PixelFormat newFormat;
+	if (!format)
+		newFormat = Graphics::PixelFormat::createFormatCLUT8();
+	else
+		newFormat = *format;
+
+	assert(newFormat.bytesPerPixel > 0);
+
+	if (newFormat != _videoMode.format) {
+		_videoMode.format = newFormat;
+		_transactionDetails.formatChanged = true;
+		_screenFormat = newFormat;
+	}
+#endif
+
+	// Avoid redundant res changes
+	if ((int)width == _videoMode.screenWidth && (int)height == _videoMode.screenHeight)
+		return;
+
+	_videoMode.screenWidth = width;
+	_videoMode.screenHeight = height;
+
+	_transactionDetails.sizeChanged = true;
 }
 
 int OpenGLGraphicsManager::getScreenChangeID() const {
@@ -105,11 +143,107 @@
 //
 
 void OpenGLGraphicsManager::beginGFXTransaction() {
+	assert(_transactionMode == kTransactionNone);
 
+	_transactionMode = kTransactionActive;
+	_transactionDetails.sizeChanged = false;
+	_transactionDetails.needHotswap = false;
+	_transactionDetails.needUpdatescreen = false;
+#ifdef USE_RGB_COLOR
+	_transactionDetails.formatChanged = false;
+#endif
+
+	_oldVideoMode = _videoMode;
 }
 
 OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
-	return OSystem::kTransactionSuccess;
+	int errors = OSystem::kTransactionSuccess;
+
+	assert(_transactionMode != kTransactionNone);
+
+	if (_transactionMode == kTransactionRollback) {
+		if (_videoMode.fullscreen != _oldVideoMode.fullscreen) {
+			errors |= OSystem::kTransactionFullscreenFailed;
+
+			_videoMode.fullscreen = _oldVideoMode.fullscreen;
+		/*} else if (_videoMode.aspectRatioCorrection != _oldVideoMode.aspectRatioCorrection) {
+			errors |= OSystem::kTransactionAspectRatioFailed;
+
+			_videoMode.aspectRatioCorrection = _oldVideoMode.aspectRatioCorrection;*/
+		} else if (_videoMode.mode != _oldVideoMode.mode) {
+			errors |= OSystem::kTransactionModeSwitchFailed;
+
+			_videoMode.mode = _oldVideoMode.mode;
+			_videoMode.scaleFactor = _oldVideoMode.scaleFactor;
+#ifdef USE_RGB_COLOR
+		} else if (_videoMode.format != _oldVideoMode.format) {
+			errors |= OSystem::kTransactionFormatNotSupported;
+
+			_videoMode.format = _oldVideoMode.format;
+			_screenFormat = _videoMode.format;
+#endif
+		} else if (_videoMode.screenWidth != _oldVideoMode.screenWidth || _videoMode.screenHeight != _oldVideoMode.screenHeight) {
+			errors |= OSystem::kTransactionSizeChangeFailed;
+
+			_videoMode.screenWidth = _oldVideoMode.screenWidth;
+			_videoMode.screenHeight = _oldVideoMode.screenHeight;
+			_videoMode.overlayWidth = _oldVideoMode.overlayWidth;
+			_videoMode.overlayHeight = _oldVideoMode.overlayHeight;
+		}
+
+		if (_videoMode.fullscreen == _oldVideoMode.fullscreen &&
+			//_videoMode.aspectRatioCorrection == _oldVideoMode.aspectRatioCorrection &&
+			_videoMode.mode == _oldVideoMode.mode &&
+			_videoMode.screenWidth == _oldVideoMode.screenWidth &&
+		   	_videoMode.screenHeight == _oldVideoMode.screenHeight) {
+
+			// Our new video mode would now be exactly the same as the
+			// old one. Since we still can not assume SDL_SetVideoMode
+			// to be working fine, we need to invalidate the old video
+			// mode, so loadGFXMode would error out properly.
+			_oldVideoMode.setup = false;
+		}
+	}
+
+#ifdef USE_RGB_COLOR
+	if (_transactionDetails.sizeChanged || _transactionDetails.formatChanged) {
+#else
+	if (_transactionDetails.sizeChanged) {
+#endif
+		unloadGFXMode();
+		if (!loadGFXMode()) {
+			if (_oldVideoMode.setup) {
+				_transactionMode = kTransactionRollback;
+				errors |= endGFXTransaction();
+			}
+		} else {
+			//setGraphicsModeIntern();
+			//clearOverlay();
+
+			_videoMode.setup = true;
+			_screenChangeCount++;
+		}
+	} else if (_transactionDetails.needHotswap) {
+		//setGraphicsModeIntern();
+		if (!hotswapGFXMode()) {
+			if (_oldVideoMode.setup) {
+				_transactionMode = kTransactionRollback;
+				errors |= endGFXTransaction();
+			}
+		} else {
+			_videoMode.setup = true;
+			_screenChangeCount++;
+
+			if (_transactionDetails.needUpdatescreen)
+				internUpdateScreen();
+		}
+	} else if (_transactionDetails.needUpdatescreen) {
+		//setGraphicsModeIntern();
+		internUpdateScreen();
+	}
+
+	_transactionMode = kTransactionNone;
+	return (OSystem::TransactionError)errors;
 }
 
 //
@@ -117,11 +251,11 @@
 //
 
 int16 OpenGLGraphicsManager::getHeight() {
-	return 0;
+	return _videoMode.screenHeight;
 }
 
 int16 OpenGLGraphicsManager::getWidth() {
-	return 0;
+	return _videoMode.screenWidth;
 }
 
 void OpenGLGraphicsManager::setPalette(const byte *colors, uint start, uint num) {
@@ -194,11 +328,11 @@
 }
 
 int16 OpenGLGraphicsManager::getOverlayHeight() {
-	return 0;
+	return _videoMode.overlayHeight;
 }
 
 int16 OpenGLGraphicsManager::getOverlayWidth() {
-	return 0;
+	return _videoMode.overlayWidth;
 }
 
 //

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-07-11 04:32:24 UTC (rev 50796)
@@ -96,13 +96,54 @@
 	GLTexture* _overlayTexture;
 	GLTexture* _mouseTexture;
 
-
-	Graphics::Surface _lockedScreen;
-
 	virtual void internUpdateScreen();
 	virtual bool loadGFXMode();
 	virtual void unloadGFXMode();
 	virtual bool hotswapGFXMode();
+
+	Graphics::Surface _lockedScreen;
+	int _screenChangeCount;
+
+#ifdef USE_RGB_COLOR
+	Graphics::PixelFormat _screenFormat;
+	Graphics::PixelFormat _cursorFormat;
+#endif
+
+	enum {
+		kTransactionNone = 0,
+		kTransactionActive = 1,
+		kTransactionRollback = 2
+	};
+
+	struct TransactionDetails {
+		bool sizeChanged;
+		bool needHotswap;
+		bool needUpdatescreen;
+#ifdef USE_RGB_COLOR
+		bool formatChanged;
+#endif
+	};
+	TransactionDetails _transactionDetails;
+	int _transactionMode;
+
+	struct VideoState {
+		bool setup;
+
+		bool fullscreen;
+		//bool aspectRatioCorrection;
+		//AspectRatio desiredAspectRatio;
+
+		int mode;
+		int scaleFactor;
+
+		int screenWidth, screenHeight;
+		int overlayWidth, overlayHeight;
+		int hardwareWidth, hardwareHeight;
+#ifdef USE_RGB_COLOR
+		Graphics::PixelFormat format;
+#endif
+	};
+	VideoState _videoMode, _oldVideoMode;
 };
 
 #endif

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-07-11 04:32:24 UTC (rev 50796)
@@ -25,17 +25,17 @@
 
 #include "backends/graphics/openglsdl/openglsdl-graphics.h"
 
-OpenGLSDLGraphicsManager::OpenGLSDLGraphicsManager()
+OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
 	:
 	_hwscreen(0) {
 
 }
 
-OpenGLSDLGraphicsManager::~OpenGLSDLGraphicsManager() {
+OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
 
 }
 
-void OpenGLSDLGraphicsManager::init() {
+void OpenGLSdlGraphicsManager::init() {
 	if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
 		error("Could not initialize SDL: %s", SDL_GetError());
 	}
@@ -45,50 +45,74 @@
 	OpenGLGraphicsManager::init();
 }
 
-void OpenGLSDLGraphicsManager::forceFullRedraw() {
+void OpenGLSdlGraphicsManager::forceFullRedraw() {
 
 }
 
-bool OpenGLSDLGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
+bool OpenGLSdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
 	return false;
 }
 
-bool OpenGLSDLGraphicsManager::isScalerHotkey(const Common::Event &event) {
+bool OpenGLSdlGraphicsManager::isScalerHotkey(const Common::Event &event) {
 	return false;
 }
 
-void OpenGLSDLGraphicsManager::adjustMouseEvent(Common::Event &event) {
+void OpenGLSdlGraphicsManager::adjustMouseEvent(Common::Event &event) {
 
 }
 
-void OpenGLSDLGraphicsManager::setMousePos(int x, int y) {
+void OpenGLSdlGraphicsManager::setMousePos(int x, int y) {
 
 }
 
-void OpenGLSDLGraphicsManager::toggleFullScreen() {
+void OpenGLSdlGraphicsManager::toggleFullScreen() {
 
 }
 
-bool OpenGLSDLGraphicsManager::saveScreenshot(const char *filename) {
+bool OpenGLSdlGraphicsManager::saveScreenshot(const char *filename) {
 	return false;
 }
 
 //
-// Protected
+// Intern
 //
 
-bool OpenGLSDLGraphicsManager::loadGFXMode() {
-	return false;
-}
+bool OpenGLSdlGraphicsManager::loadGFXMode() {
+	_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+	_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+	_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+	_videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
 
-void OpenGLSDLGraphicsManager::unloadGFXMode() {
 
+	_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 32,
+		_videoMode.fullscreen ? (SDL_FULLSCREEN | SDL_OPENGL) : SDL_OPENGL
+	);
+	if (_hwscreen == NULL) {
+		// DON'T use error(), as this tries to bring up the debug
+		// console, which WON'T WORK now that _hwscreen is hosed.
+
+		if (!_oldVideoMode.setup) {
+			warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError());
+			g_system->quit();
+		} else {
+			return false;
+		}
+	}
+
+	return true;
 }
 
-bool OpenGLSDLGraphicsManager::hotswapGFXMode() {
+void OpenGLSdlGraphicsManager::unloadGFXMode() {
+	if (_hwscreen) {
+		SDL_FreeSurface(_hwscreen);
+		_hwscreen = NULL;
+	}
+}
+
+bool OpenGLSdlGraphicsManager::hotswapGFXMode() {
 	return false;
 }
 
-void OpenGLSDLGraphicsManager::internUpdateScreen() {
+void OpenGLSdlGraphicsManager::internUpdateScreen() {
 	
 }

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h	2010-07-11 04:32:24 UTC (rev 50796)
@@ -37,10 +37,10 @@
 /**
  * SDL OpenGL graphics manager
  */
-class OpenGLSDLGraphicsManager : public OpenGLGraphicsManager {
+class OpenGLSdlGraphicsManager : public OpenGLGraphicsManager {
 public:
-	OpenGLSDLGraphicsManager();
-	virtual ~OpenGLSDLGraphicsManager();
+	OpenGLSdlGraphicsManager();
+	virtual ~OpenGLSdlGraphicsManager();
 
 	virtual void init();
 

Deleted: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/basesdl-graphics.h	2010-07-11 04:32:24 UTC (rev 50796)
@@ -1,79 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef BACKENDS_GRAPHICS_BASESDL_H
-#define BACKENDS_GRAPHICS_BASESDL_H
-
-#include "backends/graphics/graphics.h"
-
-#if defined(__SYMBIAN32__)
-#include <esdl\SDL.h>
-#else
-#include <SDL.h>
-#endif
-
-/**
- * Base SDL graphics manager, contains common functions
- * used by other SDL managers
- */
-class BaseSdlGraphicsManager : public GraphicsManager {
-public:
-	/**
-	 * Marks the screen for a full redraw
-	 */
-	virtual void forceFullRedraw() = 0;
-
-	/**
-	 * Handles the scalar hotkeys
-	 */
-	virtual bool handleScalerHotkeys(const SDL_KeyboardEvent &key) = 0;
-
-	/**
-	 * Returns if the event passed is a hotkey for the graphics scalers
-	 */
-	virtual bool isScalerHotkey(const Common::Event &event) = 0;
-
-	/**
-	 * Adjusts mouse event coords for the current scaler
-	 */
-	virtual void adjustMouseEvent(Common::Event &event) = 0;
-
-	/**
-	 * Updates the mouse cursor position
-	 */
-	virtual void setMousePos(int x, int y) = 0;
-
-	/**
-	 * Toggles fullscreen
-	 */
-	virtual void toggleFullScreen() = 0;
-
-	/**
-	 * Saves a screenshot to a file
-	 */
-	virtual bool saveScreenshot(const char *filename) = 0;
-};
-
-#endif

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-07-11 04:32:24 UTC (rev 50796)
@@ -1967,9 +1967,10 @@
 }
 #endif
 
-bool SdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
+bool SdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) {
+
 	// Ctrl-Alt-a toggles aspect ratio correction
-	if (key.keysym.sym == 'a') {
+	if (key == 'a') {
 		beginGFXTransaction();
 			setFeatureState(OSystem::kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection);
 		endGFXTransaction();
@@ -1995,18 +1996,18 @@
 	int factor = _videoMode.scaleFactor - 1;
 
 	// Increase/decrease the scale factor
-	if (key.keysym.sym == SDLK_EQUALS || key.keysym.sym == SDLK_PLUS || key.keysym.sym == SDLK_MINUS ||
-		key.keysym.sym == SDLK_KP_PLUS || key.keysym.sym == SDLK_KP_MINUS) {
-		factor += (key.keysym.sym == SDLK_MINUS || key.keysym.sym == SDLK_KP_MINUS) ? -1 : +1;
+	if (key == SDLK_EQUALS || key == SDLK_PLUS || key == SDLK_MINUS ||
+		key == SDLK_KP_PLUS || key == SDLK_KP_MINUS) {
+		factor += (key == SDLK_MINUS || key == SDLK_KP_MINUS) ? -1 : +1;
 		if (0 <= factor && factor <= 3) {
 			newMode = s_gfxModeSwitchTable[_scalerType][factor];
 		}
 	}
 
-	const bool isNormalNumber = (SDLK_1 <= key.keysym.sym && key.keysym.sym <= SDLK_9);
-	const bool isKeypadNumber = (SDLK_KP1 <= key.keysym.sym && key.keysym.sym <= SDLK_KP9);
+	const bool isNormalNumber = (SDLK_1 <= key && key <= SDLK_9);
+	const bool isKeypadNumber = (SDLK_KP1 <= key && key <= SDLK_KP9);
 	if (isNormalNumber || isKeypadNumber) {
-		_scalerType = key.keysym.sym - (isNormalNumber ? SDLK_1 : SDLK_KP1);
+		_scalerType = key - (isNormalNumber ? SDLK_1 : SDLK_KP1);
 		if (_scalerType >= ARRAYSIZE(s_gfxModeSwitchTable))
 			return false;
 

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h	2010-07-11 04:32:24 UTC (rev 50796)
@@ -26,10 +26,16 @@
 #ifndef BACKENDS_GRAPHICS_SDL_H
 #define BACKENDS_GRAPHICS_SDL_H
 
-#include "backends/graphics/sdl/basesdl-graphics.h"
+#include "backends/graphics/graphics.h"
 #include "common/system.h"
 #include "graphics/scaler.h"
 
+#if defined(__SYMBIAN32__)
+#include <esdl\SDL.h>
+#else
+#include <SDL.h>
+#endif
+
 #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
 // Uncomment this to enable the 'on screen display' code.
 #define USE_OSD	1
@@ -66,7 +72,7 @@
 /**
  * SDL graphics manager
  */
-class SdlGraphicsManager : public BaseSdlGraphicsManager {
+class SdlGraphicsManager : public GraphicsManager {
 public:
 	SdlGraphicsManager();
 	virtual ~SdlGraphicsManager();
@@ -122,7 +128,7 @@
 #endif
 
 	virtual void forceFullRedraw();
-	virtual bool handleScalerHotkeys(const SDL_KeyboardEvent &key);
+	virtual bool handleScalerHotkeys(Common::KeyCode key);
 	virtual bool isScalerHotkey(const Common::Event &event);
 	virtual void adjustMouseEvent(Common::Event &event);
 	virtual void setMousePos(int x, int y);

Modified: scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp	2010-07-11 04:32:24 UTC (rev 50796)
@@ -70,6 +70,11 @@
 	return _graphicsManager->getFeatureState(f);
 }
 
+GraphicsManager *ModularBackend::getGraphicsManager() {
+	assert(_graphicsManager);
+	return (GraphicsManager *)_graphicsManager;
+}
+
 const OSystem::GraphicsMode *ModularBackend::getSupportedGraphicsModes() const {
 	return _graphicsManager->getSupportedGraphicsModes();
 }

Modified: scummvm/branches/gsoc2010-opengl/backends/modular-backend.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/modular-backend.h	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/modular-backend.h	2010-07-11 04:32:24 UTC (rev 50796)
@@ -69,6 +69,7 @@
 	/** @name Graphics */
 	//@{
 
+	virtual GraphicsManager *getGraphicsManager();
 	virtual const GraphicsMode *getSupportedGraphicsModes() const;
 	virtual int getDefaultGraphicsMode() const;
 	virtual bool setGraphicsMode(int mode);

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-07-11 04:32:24 UTC (rev 50796)
@@ -86,9 +86,9 @@
 	if (_graphicsManager == 0) {
 		// Changed to OpenGL for testing
 		//_graphicsManager = new SdlGraphicsManager();
-		_graphicsManager = new OpenGLSDLGraphicsManager();
+		_graphicsManager = new OpenGLSdlGraphicsManager();
 
-		((OpenGLSDLGraphicsManager *)_graphicsManager)->init();
+		((OpenGLSdlGraphicsManager *)_graphicsManager)->init();
 	}
 
 	if (_audiocdManager == 0)
@@ -241,11 +241,6 @@
 	free(icon);
 }
 
-BaseSdlGraphicsManager *OSystem_SDL::getGraphicsManager() {
-	assert(_graphicsManager);
-	return (BaseSdlGraphicsManager *)_graphicsManager;
-}
-
 bool OSystem_SDL::pollEvent(Common::Event &event) {
 	assert(_eventManager);
 	return ((SdlEventManager *)_eventManager)->pollSdlEvent(event);

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-07-10 22:47:29 UTC (rev 50795)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-07-11 04:32:24 UTC (rev 50796)
@@ -33,7 +33,6 @@
 #endif
 
 #include "backends/modular-backend.h"
-#include "backends/graphics/sdl/basesdl-graphics.h"
 #include "backends/mixer/sdl/sdl-mixer.h"
 
 /** 
@@ -52,11 +51,6 @@
 	virtual void init();
 
 	/**
-	 * Get the Graphics Manager instance. Used by other managers.
-	 */
-	virtual BaseSdlGraphicsManager *getGraphicsManager();
-
-	/**
 	 * Get the Mixer Manager instance. Not to confuse with getMixer(),
 	 * that returns Audio::Mixer. The Mixer Manager is a SDL wrapper class
 	 * for the Audio::Mixer. Used by other managers.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list