[Scummvm-cvs-logs] CVS: scummvm/backends/sdl sdl-common.cpp,1.110,1.111 sdl-common.h,1.49,1.50 sdl.cpp,1.61,1.62

Max Horn fingolfin at users.sourceforge.net
Sat Feb 28 05:17:03 CET 2004


Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32588/backends/sdl

Modified Files:
	sdl-common.cpp sdl-common.h sdl.cpp 
Log Message:
renamed more OSystem methods to follow our naming scheme; renamed NewGuiColor to OverlayColor; fixed some calls to error() in the SDL backend

Index: sdl-common.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- sdl-common.cpp	27 Feb 2004 19:35:51 -0000	1.110
+++ sdl-common.cpp	28 Feb 2004 12:57:52 -0000	1.111
@@ -95,11 +95,11 @@
 	if (joystick_num > -1)
 		sdlFlags |= SDL_INIT_JOYSTICK;
 
-	if (SDL_Init(sdlFlags) ==-1) {
-		error("Could not initialize SDL: %s.\n", SDL_GetError());
+	if (SDL_Init(sdlFlags) == -1) {
+		error("Could not initialize SDL: %s", SDL_GetError());
 	}
 
-	_graphicsMutex = create_mutex();
+	_graphicsMutex = createMutex();
 
 	SDL_ShowCursor(SDL_DISABLE);
 	
@@ -156,7 +156,7 @@
 		free(_dirty_checksums);
 	free(_currentPalette);
 	free(_mouseBackup);
-	delete_mutex(_graphicsMutex);
+	deleteMutex(_graphicsMutex);
 
 	SDL_ShowCursor(SDL_ENABLE);
 	SDL_Quit();
@@ -229,7 +229,7 @@
 
 	// Try to lock the screen surface
 	if (SDL_LockSurface(_screen) == -1)
-		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
+		error("SDL_LockSurface failed: %s", SDL_GetError());
 
 	byte *dst = (byte *)_screen->pixels + y * _screenWidth + x;
 
@@ -268,7 +268,7 @@
 
 	// Try to lock the screen surface
 	if (SDL_LockSurface(_screen) == -1)
-		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
+		error("SDL_LockSurface failed: %s", SDL_GetError());
 
 	// vertical movement
 	if (dy > 0) {
@@ -535,7 +535,7 @@
 		_mouseCurState.x = x;
 		_mouseCurState.y = y;
 		undraw_mouse();
-		update_screen();
+		updateScreen();
 	}
 }
 
@@ -1050,14 +1050,18 @@
 	SDL_CloseAudio();
 }
 
+int OSystem_SDL_Common::getOutputSampleRate() const {
+	return SAMPLES_PER_SEC;
+}
+
 const OSystem::GraphicsMode *OSystem_SDL_Common::getSupportedGraphicsModes() const {
 	return s_supportedGraphicsModes;
 }
 
-void OSystem_SDL_Common::update_screen() {
+void OSystem_SDL_Common::updateScreen() {
 	Common::StackLock lock(_graphicsMutex, this);	// Lock the mutex until this function ends
 
-	intern_update_screen();
+	internUpdateScreen();
 }
 
 bool OSystem_SDL_Common::setGraphicsMode(int mode) {
@@ -1131,7 +1135,7 @@
 		_forceFull = true;
 
 		// Blit everything to the screen
-		intern_update_screen();
+		internUpdateScreen();
 	
 		// Make sure that an EVENT_SCREEN_CHANGED gets sent later
 		_modeChanged = true;
@@ -1149,29 +1153,6 @@
 	SDL_WM_SetCaption(caption, caption);
 }
 
-bool OSystem_SDL_Common::openCD(int drive) {
-	if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
-		_cdrom = NULL;
-	else {
-		_cdrom = SDL_CDOpen(drive);
-		// Did it open? Check if _cdrom is NULL
-		if (!_cdrom) {
-			warning("Couldn't open drive: %s", SDL_GetError());
-		} else {
-			cd_num_loops = 0;
-			cd_stop_time = 0;
-			cd_end_time = 0;
-		}
-	}
-	
-	return (_cdrom != NULL);
-}
-
-int OSystem_SDL_Common::getOutputSampleRate() const {
-	return SAMPLES_PER_SEC;
-}
-
-
 bool OSystem_SDL_Common::hasFeature(Feature f) {
 	return
 		(f == kFeatureFullscreenMode) ||
@@ -1278,7 +1259,7 @@
 
 	// Draw the mouse cursor; backup the covered area in "bak"
 	if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1)
-		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
+		error("SDL_LockSurface failed: %s", SDL_GetError());
 
 	// Mark as dirty
 	add_dirty_rect(x, y, w, h);
@@ -1338,7 +1319,7 @@
 	_mouseDrawn = false;
 
 	if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1)
-		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
+		error("SDL_LockSurface failed: %s", SDL_GetError());
 
 	const int old_mouse_x = _mouseOldState.x;
 	const int old_mouse_y = _mouseOldState.y;
@@ -1375,6 +1356,24 @@
 	SDL_UnlockSurface(_overlayVisible ? _tmpscreen : _screen);
 }
 
+bool OSystem_SDL_Common::openCD(int drive) {
+	if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
+		_cdrom = NULL;
+	else {
+		_cdrom = SDL_CDOpen(drive);
+		// Did it open? Check if _cdrom is NULL
+		if (!_cdrom) {
+			warning("Couldn't open drive: %s", SDL_GetError());
+		} else {
+			cd_num_loops = 0;
+			cd_stop_time = 0;
+			cd_end_time = 0;
+		}
+	}
+	
+	return (_cdrom != NULL);
+}
+
 void OSystem_SDL_Common::stop_cdrom() {	/* Stop CD Audio in 1/10th of a second */
 	cd_stop_time = SDL_GetTicks() + 100;
 	cd_num_loops = 0;
@@ -1488,19 +1487,19 @@
 	SDL_FreeSurface(sdl_surf);
 }
 
-OSystem::MutexRef OSystem_SDL_Common::create_mutex(void) {
+OSystem::MutexRef OSystem_SDL_Common::createMutex(void) {
 	return (MutexRef) SDL_CreateMutex();
 }
 
-void OSystem_SDL_Common::lock_mutex(MutexRef mutex) {
+void OSystem_SDL_Common::lockMutex(MutexRef mutex) {
 	SDL_mutexP((SDL_mutex *) mutex);
 }
 
-void OSystem_SDL_Common::unlock_mutex(MutexRef mutex) {
+void OSystem_SDL_Common::unlockMutex(MutexRef mutex) {
 	SDL_mutexV((SDL_mutex *) mutex);
 }
 
-void OSystem_SDL_Common::delete_mutex(MutexRef mutex) {
+void OSystem_SDL_Common::deleteMutex(MutexRef mutex) {
 	SDL_DestroyMutex((SDL_mutex *) mutex);
 }
 
@@ -1560,7 +1559,7 @@
 	undraw_mouse();
 
 	if (SDL_LockSurface(_tmpscreen) == -1)
-		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
+		error("SDL_LockSurface failed: %s", SDL_GetError());
 
 	int16 *src = (int16 *)_tmpscreen->pixels + _tmpScreenWidth + 1;
 	int h = _screenHeight;
@@ -1611,7 +1610,7 @@
 	undraw_mouse();
 
 	if (SDL_LockSurface(_tmpscreen) == -1)
-		error("SDL_LockSurface failed: %s.\n", SDL_GetError());
+		error("SDL_LockSurface failed: %s", SDL_GetError());
 
 	int16 *dst = (int16 *)_tmpscreen->pixels + (y + 1) * _tmpScreenWidth + (x + 1);
 	do {
@@ -1623,7 +1622,7 @@
 	SDL_UnlockSurface(_tmpscreen);
 }
 
-void OSystem_SDL_Common::set_palette(const byte *colors, uint start, uint num) {
+void OSystem_SDL_Common::setPalette(const byte *colors, uint start, uint num) {
 	const byte *b = colors;
 	uint i;
 	SDL_Color *base = _currentPalette + start;

Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- sdl-common.h	27 Feb 2004 19:35:51 -0000	1.49
+++ sdl-common.h	28 Feb 2004 12:57:52 -0000	1.50
@@ -37,7 +37,7 @@
 	void initSize(uint w, uint h);
 
 	// Set colors of the palette
-	void set_palette(const byte *colors, uint start, uint num);
+	void setPalette(const byte *colors, uint start, uint num);
 
 	// Draw a bitmap to screen.
 	// The screen will not be updated to reflect the new bitmap
@@ -46,7 +46,7 @@
 	void move_screen(int dx, int dy, int height);
 
 	// Update the dirty areas of the screen
-	void update_screen();
+	void updateScreen();
 
 	// Either show or hide the mouse cursor
 	bool show_mouse(bool visible);
@@ -98,10 +98,10 @@
 	void set_timer(TimerProc callback, int timer);
 
 	// Mutex handling
-	MutexRef create_mutex();
-	void lock_mutex(MutexRef mutex);
-	void unlock_mutex(MutexRef mutex);
-	void delete_mutex(MutexRef mutex);
+	MutexRef createMutex();
+	void lockMutex(MutexRef mutex);
+	void unlockMutex(MutexRef mutex);
+	void deleteMutex(MutexRef mutex);
 
 	// Overlay
 	virtual void show_overlay();
@@ -159,7 +159,7 @@
 		DF_UPDATE_EXPAND_1_PIXEL	= 1 << 1
 	};
 
-	bool _forceFull; // Force full redraw on next update_screen
+	bool _forceFull; // Force full redraw on next updateScreen
 	ScalerProc *_scaler_proc;
 	int _scaleFactor;
 	int _mode;
@@ -217,8 +217,10 @@
 	SDL_Color *_currentPalette;
 	uint _paletteDirtyStart, _paletteDirtyEnd;
 	
-	// Mutex that prevents multiple threads interferring with each other
-	// when accessing the screen.
+	/**
+	 * Mutex which prevents multiple threads from interfering with each other
+	 * when accessing the screen.
+	 */
 	MutexRef _graphicsMutex;
 
 
@@ -235,7 +237,7 @@
 	void toggleMouseGrab();
 
 
-	virtual void intern_update_screen() = 0;
+	virtual void internUpdateScreen() = 0;
 
 	virtual void load_gfx_mode() = 0;
 	virtual void unload_gfx_mode() = 0;

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- sdl.cpp	27 Feb 2004 19:35:51 -0000	1.61
+++ sdl.cpp	28 Feb 2004 12:57:52 -0000	1.62
@@ -28,7 +28,7 @@
 	OSystem_SDL();
 
 	// Update the dirty areas of the screen
-	void intern_update_screen();
+	void internUpdateScreen();
 
 protected:
 	SDL_Surface *_hwscreen;    // hardware screen
@@ -222,13 +222,13 @@
 	SDL_FreeSurface(old_tmpscreen);
 
 	// Blit everything to the screen
-	intern_update_screen();
+	internUpdateScreen();
 	
 	// Make sure that an EVENT_SCREEN_CHANGED gets sent later
 	_modeChanged = true;
 }
 
-void OSystem_SDL::intern_update_screen() {
+void OSystem_SDL::internUpdateScreen() {
 	assert(_hwscreen != NULL);
 
 	// If the shake position changed, fill the dirty area with blackness





More information about the Scummvm-git-logs mailing list