[Scummvm-cvs-logs] CVS: scummvm/backends/sdl graphics.cpp,1.1,1.2 sdl-common.h,1.51,1.52 sdl.cpp,1.64,1.65

Max Horn fingolfin at users.sourceforge.net
Sun Feb 29 18:00:00 CET 2004


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

Modified Files:
	graphics.cpp sdl-common.h sdl.cpp 
Log Message:
got rid of _mouseOldState; some minor cleanup

Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/graphics.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- graphics.cpp	29 Feb 2004 00:49:40 -0000	1.1
+++ graphics.cpp	1 Mar 2004 01:41:22 -0000	1.2
@@ -221,7 +221,7 @@
 	// Create the surface that contains the scaled graphics in 16 bit mode
 	//
 
-	_hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactor, 16, 
+	_hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, effectiveScreenHeight(), 16, 
 		_full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
 	);
 	if (_hwscreen == NULL) {
@@ -269,7 +269,7 @@
 
 	// keyboard cursor control, some other better place for it?
 	km.x_max = _screenWidth * _scaleFactor - 1;
-	km.y_max = (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactor - 1;
+	km.y_max = effectiveScreenHeight() - 1;
 	km.delay_time = 25;
 	km.last_time = 0;
 }
@@ -450,7 +450,7 @@
 		// This is necessary if shaking is active.
 		if (_forceFull) {
 			_dirty_rect_list[0].y = 0;
-			_dirty_rect_list[0].h = (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactor;
+			_dirty_rect_list[0].h = effectiveScreenHeight();
 		}
 
 		// Finally, blit all our changes to the screen
@@ -470,12 +470,13 @@
 }
 
 void OSystem_SDL::setFullscreenMode(bool enable) {
+	Common::StackLock lock(_graphicsMutex, this);
+
 	if (_full_screen != enable) {
 		assert(_hwscreen != 0);
 		_full_screen ^= true;
 
-		if (_mouseDrawn)
-			undraw_mouse();
+		undraw_mouse();
 	
 #if defined(MACOSX) && !SDL_VERSION_ATLEAST(1, 2, 6)
 		// On OS X, SDL_WM_ToggleFullScreen is currently not implemented. Worse,
@@ -537,8 +538,7 @@
 	}
 
 	/* FIXME: undraw mouse only if the draw rect intersects with the mouse rect */
-	if (_mouseDrawn)
-		undraw_mouse();
+	undraw_mouse();
 
 	// Try to lock the screen surface
 	if (SDL_LockSurface(_screen) == -1)
@@ -728,8 +728,7 @@
 	_forceFull = true;
 
 	// Hide the mouse
-	if (_mouseDrawn)
-		undraw_mouse();
+	undraw_mouse();
 
 	// Try to lock the screen surface
 	if (SDL_LockSurface(_screen) == -1)
@@ -935,9 +934,9 @@
 
 void OSystem_SDL::set_mouse_pos(int x, int y) {
 	if (x != _mouseCurState.x || y != _mouseCurState.y) {
+		undraw_mouse();
 		_mouseCurState.x = x;
 		_mouseCurState.y = y;
-		undraw_mouse();
 		updateScreen();
 	}
 }
@@ -958,6 +957,9 @@
 }
 	
 void OSystem_SDL::set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {
+
+	undraw_mouse();
+
 	assert(w <= MAX_MOUSE_W);
 	assert(h <= MAX_MOUSE_H);
 	_mouseCurState.w = w;
@@ -967,8 +969,6 @@
 	_mouseHotspotY = hotspot_y;
 
 	_mouseData = buf;
-
-	undraw_mouse();
 }
 
 void OSystem_SDL::toggleMouseGrab() {
@@ -1010,13 +1010,6 @@
 	if (w <= 0 || h <= 0)
 		return;
 
-	// Store the bounding box so that undraw mouse can restore the area the
-	// mouse currently covers to its original content.
-	_mouseOldState.x = x;
-	_mouseOldState.y = y;
-	_mouseOldState.w = w;
-	_mouseOldState.h = h;
-
 	// Draw the mouse cursor; backup the covered area in "bak"
 	if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1)
 		error("SDL_LockSurface failed: %s", SDL_GetError());
@@ -1081,10 +1074,10 @@
 	if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1)
 		error("SDL_LockSurface failed: %s", SDL_GetError());
 
-	const int old_mouse_x = _mouseOldState.x;
-	const int old_mouse_y = _mouseOldState.y;
-	const int old_mouse_w = _mouseOldState.w;
-	const int old_mouse_h = _mouseOldState.h;
+	const int old_mouse_x = _mouseCurState.x;
+	const int old_mouse_y = _mouseCurState.y;
+	const int old_mouse_w = _mouseCurState.w;
+	const int old_mouse_h = _mouseCurState.h;
 	int x, y;
 
 	if (!_overlayVisible) {
@@ -1115,4 +1108,3 @@
 
 	SDL_UnlockSurface(_overlayVisible ? _tmpscreen : _screen);
 }
-

Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- sdl-common.h	29 Feb 2004 00:49:40 -0000	1.51
+++ sdl-common.h	1 Mar 2004 01:41:22 -0000	1.52
@@ -201,7 +201,6 @@
 	const byte *_mouseData;
 	byte *_mouseBackup;
 	MousePos _mouseCurState;
-	MousePos _mouseOldState;
 	int16 _mouseHotspotX;
 	int16 _mouseHotspotY;
 

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- sdl.cpp	29 Feb 2004 00:49:40 -0000	1.64
+++ sdl.cpp	1 Mar 2004 01:41:22 -0000	1.65
@@ -132,14 +132,14 @@
 }
 
 void OSystem_SDL::setFeatureState(Feature f, bool enable) {
-	Common::StackLock lock(_graphicsMutex, this);
-
 	switch (f) {
 	case kFeatureFullscreenMode:
 		setFullscreenMode(enable);
 		break;
 	case kFeatureAspectRatioCorrection:
 		if (_screenHeight == 200 && _adjustAspectRatio != enable) {
+			Common::StackLock lock(_graphicsMutex, this);
+
 			//assert(_hwscreen != 0);
 			_adjustAspectRatio ^= true;
 			hotswap_gfx_mode();





More information about the Scummvm-git-logs mailing list