[Scummvm-cvs-logs] SF.net SVN: scummvm: [23851] scummvm/trunk/backends/platform/wince/ wince-sdl.cpp

knakos at users.sourceforge.net knakos at users.sourceforge.net
Sat Sep 9 18:48:43 CEST 2006


Revision: 23851
          http://svn.sourceforge.net/scummvm/?rev=23851&view=rev
Author:   knakos
Date:     2006-09-09 09:48:35 -0700 (Sat, 09 Sep 2006)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wince/wince-sdl.cpp

Modified: scummvm/trunk/backends/platform/wince/wince-sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/wince-sdl.cpp	2006-09-09 16:46:33 UTC (rev 23850)
+++ scummvm/trunk/backends/platform/wince/wince-sdl.cpp	2006-09-09 16:48:35 UTC (rev 23851)
@@ -913,7 +913,7 @@
 				_scaleFactorYd = 5;
 				_scalerProc = PocketPCLandscapeAspect;
 				_modeFlags = 0;
-				_adjustAspectRatio = true;				
+				_adjustAspectRatio = true;
 			} else {
 				_scaleFactorXm = 1;
 				_scaleFactorXd = 1;
@@ -964,14 +964,14 @@
 bool OSystem_WINCE3::setGraphicsMode(int mode) {
 
 	switch (_transactionMode) {
-	case kTransactionActive:
-                _transactionDetails.mode = mode;
-                _transactionDetails.modeChanged = true;
-                return true;
-        case kTransactionCommit:
-                break;
-	default:
-                break;
+		case kTransactionActive:
+			_transactionDetails.mode = mode;
+			_transactionDetails.modeChanged = true;
+			return true;
+		case kTransactionCommit:
+			break;
+		default:
+			break;
 	}
 
 	Common::StackLock lock(_graphicsMutex);
@@ -1322,14 +1322,10 @@
 	// If the shake position changed, fill the dirty area with blackness
 	if (_currentShakePos != _newShakePos) {
 		SDL_Rect blackrect = {0, 0, _screenWidth * _scaleFactorXm / _scaleFactorXd, _newShakePos * _scaleFactorYm / _scaleFactorYd};
-
 		if (_adjustAspectRatio)
 			blackrect.h = real2Aspect(blackrect.h - 1) + 1;
-
 		SDL_FillRect(_hwscreen, &blackrect, 0);
-
 		_currentShakePos = _newShakePos;
-
 		_forceFull = true;
 	}
 
@@ -1339,12 +1335,8 @@
 	// Check whether the palette was changed in the meantime and update the
 	// screen surface accordingly.
 	if (_paletteDirtyEnd != 0) {
-		SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart,
-			_paletteDirtyStart,
-			_paletteDirtyEnd - _paletteDirtyStart);
-
+		SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart, _paletteDirtyStart, _paletteDirtyEnd - _paletteDirtyStart);
 		_paletteDirtyEnd = 0;
-
 		_forceFull = true;
 	}
 
@@ -1379,8 +1371,6 @@
 
 		_toolbarHandler.forceRedraw();
 	}
-	//else
-	//	undrawMouse();
 
 	// Only draw anything if necessary
 	if (_numDirtyRects > 0) {
@@ -1392,88 +1382,66 @@
 		bool toolbarVisible = _toolbarHandler.visible();
 		int toolbarOffset = _toolbarHandler.getOffset();
 
-		if (_scalerProc == Normal1x && !_adjustAspectRatio && 0) {
-			for (r = _dirtyRectList; r != last_rect; ++r) {
-				dst = *r;
+		for (r = _dirtyRectList; r != last_rect; ++r) {
+			dst = *r;
+			dst.x++;	// Shift rect by one since 2xSai needs to acces the data around
+			dst.y++;	// any pixel to scale it, and we want to avoid mem access crashes.
+			if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
+				error("SDL_BlitSurface failed: %s", SDL_GetError());
+		}
 
-				// Check if the toolbar is overwritten
-				if (!_forceFull && toolbarVisible && r->y + r->h >= toolbarOffset)  {
-					_toolbarHandler.forceRedraw();
-				}
+		SDL_LockSurface(srcSurf);
+		SDL_LockSurface(_hwscreen);
 
-				if (_overlayVisible) {
-					// FIXME: I don't understand why this is necessary...
-					dst.x--;
-					dst.y--;
-				}
-				dst.y += _currentShakePos;
-				if (SDL_BlitSurface(origSurf, r, _hwscreen, &dst) != 0)
-					error("SDL_BlitSurface failed: %s", SDL_GetError());
-			}
-		} else {
-				for (r = _dirtyRectList; r != last_rect; ++r) {
-					dst = *r;
-					dst.x++;	// Shift rect by one since 2xSai needs to acces the data around
-					dst.y++;	// any pixel to scale it, and we want to avoid mem access crashes.
-					if (SDL_BlitSurface(origSurf, r, srcSurf, &dst) != 0)
-						error("SDL_BlitSurface failed: %s", SDL_GetError());
-				}
+		srcPitch = srcSurf->pitch;
+		dstPitch = _hwscreen->pitch;
 
-			SDL_LockSurface(srcSurf);
-			SDL_LockSurface(_hwscreen);
+		for (r = _dirtyRectList; r != last_rect; ++r) {
+			register int dst_y = r->y + _currentShakePos;
+			register int dst_h = 0;
 
-			srcPitch = srcSurf->pitch;
-			dstPitch = _hwscreen->pitch;
+			// Check if the toolbar is overwritten
+			if (!_forceFull && toolbarVisible && r->y + r->h >= toolbarOffset)
+				_toolbarHandler.forceRedraw();
 
-			for (r = _dirtyRectList; r != last_rect; ++r) {
-				register int dst_y = r->y + _currentShakePos;
-				register int dst_h = 0;
-				register int orig_dst_y = 0;
+			if (dst_y < _screenHeight) {
+				dst_h = r->h;
+				if (dst_h > _screenHeight - dst_y)
+					dst_h = _screenHeight - dst_y;
 
-				// Check if the toolbar is overwritten
-				if (!_forceFull && toolbarVisible && r->y + r->h >= toolbarOffset) {
-					_toolbarHandler.forceRedraw();
-				}
+				dst_y *= _scaleFactorYm;
+				dst_y /= _scaleFactorYd;
 
-				if (dst_y < _screenHeight) {
-					dst_h = r->h;
-					if (dst_h > _screenHeight - dst_y)
-						dst_h = _screenHeight - dst_y;
+				if (_adjustAspectRatio)
+					dst_h = real2Aspect(dst_h);
 
-					dst_y *= _scaleFactorYm;
-					dst_y /= _scaleFactorYd;
+				// clip inside platform screen (landscape,bottom only)
+				if (_orientationLandscape && !_zoomDown && dst_y+dst_h > _screenHeight)
+					dst_h = _screenHeight - dst_y;
 
-					if (_adjustAspectRatio)
-						dst_h = real2Aspect(dst_h);
-
-					// clip inside platform screen (landscape,bottom only)
-					if (_orientationLandscape && !_zoomDown && dst_y+dst_h > _screenHeight)
-						dst_h = _screenHeight - dst_y;
-
-					if (!_zoomDown)
-						_scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
-							(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + dst_y * dstPitch, dstPitch, r->w, dst_h);
-					else {
-						_scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
-							(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + (dst_y - 240) * dstPitch, dstPitch, r->w, dst_h);
-					}
-
+				if (!_zoomDown)
+					_scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+						(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + dst_y * dstPitch, dstPitch, r->w, dst_h);
+				else {
+					_scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+						(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + (dst_y - 240) * dstPitch, dstPitch, r->w, dst_h);
 				}
 
-				r->x = r->x * _scaleFactorXm / _scaleFactorXd;
-				if (!_zoomDown)
-					r->y = dst_y;
-				else
-					r->y = dst_y - 240;
-				r->w = r->w * _scaleFactorXm / _scaleFactorXd;
-				if (!_adjustAspectRatio)
-					r->h = dst_h * _scaleFactorYm / _scaleFactorYd;
-				else
-					r->h = dst_h;
 			}
-			SDL_UnlockSurface(srcSurf);
-			SDL_UnlockSurface(_hwscreen);
+
+			r->x = r->x * _scaleFactorXm / _scaleFactorXd;
+			if (!_zoomDown)
+				r->y = dst_y;
+			else
+				r->y = dst_y - 240;
+			r->w = r->w * _scaleFactorXm / _scaleFactorXd;
+			if (!_adjustAspectRatio)
+				r->h = dst_h * _scaleFactorYm / _scaleFactorYd;
+			else
+				r->h = dst_h;
 		}
+		SDL_UnlockSurface(srcSurf);
+		SDL_UnlockSurface(_hwscreen);
 
 		// Readjust the dirty rect list in case we are doing a full update.
 		// This is necessary if shaking is active.
@@ -1539,9 +1507,6 @@
 		drawToolbarMouse(toolbarSurface, false);	// undraw toolbar mouse
 	}
 
-
-	//drawMouse();
-
 	// Finally, blit all our changes to the screen
 	if (_numDirtyRects > 0)
 		SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
@@ -1967,7 +1932,7 @@
 
 void OSystem_WINCE3::drawMouse() {
 	// FIXME
-	if (!(_toolbarHandler.visible() && _mouseCurState.y >= _toolbarHandler.getOffset() && !_usesEmulatedMouse) && !_forceHideMouse)	
+	if (!(_toolbarHandler.visible() && _mouseCurState.y >= _toolbarHandler.getOffset() && !_usesEmulatedMouse) && !_forceHideMouse)
 		internDrawMouse();		
 }
 


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