[Scummvm-cvs-logs] SF.net SVN: scummvm: [23850] scummvm/branches/branch-0-9-0/backends/wince/ wince-sdl.cpp

knakos at users.sourceforge.net knakos at users.sourceforge.net
Sat Sep 9 18:46:42 CEST 2006


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

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

Modified Paths:
--------------
    scummvm/branches/branch-0-9-0/backends/wince/wince-sdl.cpp

Modified: scummvm/branches/branch-0-9-0/backends/wince/wince-sdl.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/backends/wince/wince-sdl.cpp	2006-09-09 16:10:11 UTC (rev 23849)
+++ scummvm/branches/branch-0-9-0/backends/wince/wince-sdl.cpp	2006-09-09 16:46:33 UTC (rev 23850)
@@ -846,7 +846,6 @@
 			_transactionDetails.sizeChanged = true;
 			_transactionDetails.needUnload = true;
 			return;
-			break;
 		case kTransactionCommit:
 			break;
 		default:
@@ -964,17 +963,16 @@
 
 bool OSystem_WINCE3::setGraphicsMode(int mode) {
 
-    switch (_transactionMode) {
-			case kTransactionActive:
-                _transactionDetails.mode = mode;
-                _transactionDetails.modeChanged = true;
-                return true;
-                break;
-	        case kTransactionCommit:
-                break;
-		    default:
-                break;
-    }
+	switch (_transactionMode) {
+		case kTransactionActive:
+			_transactionDetails.mode = mode;
+			_transactionDetails.modeChanged = true;
+			return true;
+		case kTransactionCommit:
+			break;
+		default:
+			break;
+	}
 
 	Common::StackLock lock(_graphicsMutex);
 	int oldScaleFactorXm = _scaleFactorXm;
@@ -1324,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;
 	}
 
@@ -1341,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;
 	}
 
@@ -1381,8 +1371,6 @@
 
 		_toolbarHandler.forceRedraw();
 	}
-	//else
-	//	undrawMouse();
 
 	// Only draw anything if necessary
 	if (_numDirtyRects > 0) {
@@ -1394,89 +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.
@@ -1542,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);


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