[Scummvm-cvs-logs] SF.net SVN: scummvm:[40982] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri May 29 13:07:35 CEST 2009


Revision: 40982
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40982&view=rev
Author:   lordhoto
Date:     2009-05-29 11:07:35 +0000 (Fri, 29 May 2009)

Log Message:
-----------
Cleanup and slight bugfix in drawShapeProcessLineScale* functions.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/kyra/screen.h

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2009-05-29 10:52:34 UTC (rev 40981)
+++ scummvm/trunk/engines/kyra/screen.cpp	2009-05-29 11:07:35 UTC (rev 40982)
@@ -1480,19 +1480,17 @@
 
 int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) {
 	_dsTmpWidth -= cnt;
-	bool found = false;
 
-	if (src == dst || !cnt)
-		return _dsOffscreenScaleVal1;
+	while (cnt > 0) {
+		--cnt;
 
-	do {
 		if (*src++)
 			continue;
-		found = true;
+
 		cnt = cnt + 1 - (*src++);
-	} while (--cnt > 0);
+	}
 
-	if (!found || !cnt)
+	if (!cnt)
 		return _dsOffscreenScaleVal1;
 
 	_dsTmpWidth += cnt;
@@ -1509,19 +1507,17 @@
 
 int Screen::drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt) {
 	_dsTmpWidth -= cnt;
-	bool found = false;
 
-	if (src == dst || !cnt)
-		return _dsOffscreenScaleVal1;
+	while (cnt > 0) {
+		--cnt;
 
-	do {
 		if (*src++)
 			continue;
-		found = true;
+
 		cnt = cnt + 1 - (*src++);
-	} while (--cnt > 0);
+	}
 
-	if (!found || !cnt)
+	if (!cnt)
 		return _dsOffscreenScaleVal1;
 
 	_dsTmpWidth += cnt;
@@ -1568,7 +1564,7 @@
 	return found ? 0 : _dsOffscreenScaleVal1;
 }
 
-void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int) {
+void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) {
 	do {
 		uint8 c = *src++;
 		if (c) {
@@ -1583,7 +1579,7 @@
 	} while (cnt > 0);
 }
 
-void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int) {
+void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) {
 	do {
 		uint8 c = *src++;
 		if (c) {
@@ -1598,11 +1594,11 @@
 	} while (cnt > 0);
 }
 
-void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState) {
+void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) {
 	int c = 0;
 
 	do {
-		if ((scaleState >> 8) <= 0) {
+		if ((scaleState & 0x8000) || !(scaleState & 0xFF00)) {
 			c = *src++;
 			_dsTmpWidth--;
 			if (c) {
@@ -1616,10 +1612,9 @@
 				cnt -= (r >> 8);
 				scaleState = r & 0xff;
 			}
-		} else {
-			uint8 *d = dst++;
-			(this->*_dsPlot)(d, c);
-			scaleState -= 256;
+		} else if (scaleState) {
+			(this->*_dsPlot)(dst++, c);
+			scaleState -= 0x100;
 			cnt--;
 		}
 	} while (cnt > 0);
@@ -1627,11 +1622,11 @@
 	cnt = -1;
 }
 
-void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState) {
+void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) {
 	int c = 0;
 
 	do {
-		if ((scaleState >> 8) <= 0) {
+		if ((scaleState & 0x8000) || !(scaleState & 0xFF00)) {
 			c = *src++;
 			_dsTmpWidth--;
 			if (c) {
@@ -1646,9 +1641,8 @@
 				scaleState = r & 0xff;
 			}
 		} else {
-			uint8 *d = dst--;
-			(this->*_dsPlot)(d, c);
-			scaleState -= 256;
+			(this->*_dsPlot)(dst--, c);
+			scaleState -= 0x100;
 			cnt--;
 		}
 	} while (cnt > 0);

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2009-05-29 10:52:34 UTC (rev 40981)
+++ scummvm/trunk/engines/kyra/screen.h	2009-05-29 11:07:35 UTC (rev 40982)
@@ -312,10 +312,10 @@
 	int drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
 	int drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt);
 	int drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
-	void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
-	void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
-	void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
-	void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
+	void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
+	void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
+	void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
+	void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
 
 	void drawShapePlotType0(uint8 *dst, uint8 cmd);
 	void drawShapePlotType1(uint8 *dst, uint8 cmd);
@@ -337,7 +337,7 @@
 	void drawShapePlotType52(uint8 *dst, uint8 cmd);
 
 	typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt);
-	typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
+	typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState);
 	typedef void (Screen::*DsPlotFunc)(uint8 *dst, uint8 cmd);
 
 	DsMarginSkipFunc _dsProcessMargin;


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