[Scummvm-cvs-logs] SF.net SVN: scummvm:[44218] scummvm/branches/branch-1-0-0/engines/tucker

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sun Sep 20 21:26:41 CEST 2009


Revision: 44218
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44218&view=rev
Author:   cyx
Date:     2009-09-20 19:26:41 +0000 (Sun, 20 Sep 2009)

Log Message:
-----------
backport #43732 (TUCKER: some dirty rects handling fixes), should fix item #2857757

Modified Paths:
--------------
    scummvm/branches/branch-1-0-0/engines/tucker/tucker.cpp
    scummvm/branches/branch-1-0-0/engines/tucker/tucker.h

Modified: scummvm/branches/branch-1-0-0/engines/tucker/tucker.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/engines/tucker/tucker.cpp	2009-09-20 16:56:44 UTC (rev 44217)
+++ scummvm/branches/branch-1-0-0/engines/tucker/tucker.cpp	2009-09-20 19:26:41 UTC (rev 44218)
@@ -2881,9 +2881,7 @@
 	}
 	if (_charSpeechSoundCounter == 0 && !_csDataHandled) {
 		setCursorType(0);
-		return;
-	}
-	if (displayText) {
+	} else if (displayText) {
 		drawSpeechText(_actionPosX, _actionPosY, _characterSpeechDataPtr, _speechSoundNum, _actionTextColor);
 	}
 }
@@ -3788,13 +3786,12 @@
 
 void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color) {
 	int xStart = x;
-	int i = 0;
-	for (; i < count && dataPtr[pos] != '\n'; ++i) {
+	for (int i = 0; i < count && dataPtr[pos] != '\n'; ++i) {
 		Graphics::drawStringChar(_locationBackgroundGfxBuf + y * 640 + x, dataPtr[pos], 640, color, _charsetGfxBuf);
 		x += _charWidthTable[dataPtr[pos]];
 		++pos;
 	}
-	addDirtyRect(xStart, y, Graphics::_charset.charW * i, Graphics::_charset.charH);
+	addDirtyRect(xStart, y, x - xStart, Graphics::_charset.charH);
 }
 
 void TuckerEngine::redrawScreen(int offset) {
@@ -3803,21 +3800,22 @@
 	if (_fullRedraw) {
 		_fullRedraw = false;
 		_system->copyRectToScreen(_locationBackgroundGfxBuf + offset, kScreenPitch, 0, 0, kScreenWidth, kScreenHeight);
-		_dirtyRectsPrevCount = _dirtyRectsCount = 0;
 	} else {
-		const int xClip = offset % kScreenPitch;
-		const int yClip = offset / kScreenPitch;
-		Common::Rect clipRect(xClip, yClip, xClip + kScreenWidth, yClip + kScreenHeight);
-		for (int i = 0; i < _dirtyRectsPrevCount; ++i) {
-			redrawScreenRect(clipRect, _dirtyRectsTable[1][i]);
+		Common::Rect clipRect(offset, 0, offset + kScreenWidth, kScreenHeight);
+		for (int i = 0; i < _dirtyRectsPrevCount + _dirtyRectsCount; ++i) {
+			redrawScreenRect(clipRect, _dirtyRectsTable[i]);
 		}
+	}
+	if (_dirtyRectsPrevCount + _dirtyRectsCount < kMaxDirtyRects) {
 		for (int i = 0; i < _dirtyRectsCount; ++i) {
-			redrawScreenRect(clipRect, _dirtyRectsTable[0][i]);
-			_dirtyRectsTable[1][i] = _dirtyRectsTable[0][i];
+			_dirtyRectsTable[i] = _dirtyRectsTable[_dirtyRectsPrevCount + i];
 		}
 		_dirtyRectsPrevCount = _dirtyRectsCount;
-		_dirtyRectsCount = 0;
+	} else {
+		_dirtyRectsPrevCount = 0;
+		_fullRedraw = true;
 	}
+	_dirtyRectsCount = 0;
 	_system->updateScreen();
 }
 
@@ -3846,19 +3844,17 @@
 }
 
 void TuckerEngine::addDirtyRect(int x, int y, int w, int h) {
-	if (!_fullRedraw) {
+	if (_dirtyRectsPrevCount + _dirtyRectsCount < kMaxDirtyRects) {
 		Common::Rect r(x, y, x + w, y + h);
 		for (int i = 0; i < _dirtyRectsCount; ++i) {
-			if (_dirtyRectsTable[0][i].contains(r)) {
+			if (_dirtyRectsTable[_dirtyRectsPrevCount + i].contains(r)) {
 				return;
 			}
 		}
-		if (_dirtyRectsCount < kMaxDirtyRects) {
-			_dirtyRectsTable[0][_dirtyRectsCount] = r;
-			++_dirtyRectsCount;
-		} else {
-			_fullRedraw = true;
-		}
+		_dirtyRectsTable[_dirtyRectsPrevCount + _dirtyRectsCount] = r;
+		++_dirtyRectsCount;
+	} else {
+		_fullRedraw = true;
 	}
 }
 

Modified: scummvm/branches/branch-1-0-0/engines/tucker/tucker.h
===================================================================
--- scummvm/branches/branch-1-0-0/engines/tucker/tucker.h	2009-09-20 16:56:44 UTC (rev 44217)
+++ scummvm/branches/branch-1-0-0/engines/tucker/tucker.h	2009-09-20 19:26:41 UTC (rev 44218)
@@ -234,7 +234,7 @@
 		kDataTableSize = 500,
 		kSpeechHistoryTableSize = 5,
 		kMaxCharacters = 8,
-		kMaxDirtyRects = 16
+		kMaxDirtyRects = 32
 	};
 
 	TuckerEngine(OSystem *system, Common::Language language, uint32 flags);
@@ -803,7 +803,7 @@
 	uint8 _currentPalette[768];
 	bool _fullRedraw;
 	int _dirtyRectsPrevCount, _dirtyRectsCount;
-	Common::Rect _dirtyRectsTable[2][kMaxDirtyRects];
+	Common::Rect _dirtyRectsTable[kMaxDirtyRects];
 
 	int _updateLocationFadePaletteCounter;
 	int _updateLocationCounter;


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