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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Mar 30 04:43:22 CEST 2008


Revision: 31317
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31317&view=rev
Author:   athrxx
Date:     2008-03-29 19:43:22 -0700 (Sat, 29 Mar 2008)

Log Message:
-----------
- get rid of const_cast

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	2008-03-30 02:43:18 UTC (rev 31316)
+++ scummvm/trunk/engines/kyra/screen.cpp	2008-03-30 02:43:22 UTC (rev 31317)
@@ -1331,7 +1331,7 @@
 		}
 
 		t *= -1;
-		const uint8 *tmp = dst;
+		uint8 *tmp = dst;
 
 		do {
 			_dsOffscreenScaleVal1 = 0;
@@ -1416,7 +1416,7 @@
 		addDirtyRect(x, y, shpWidthScaled1, shapeHeight);
 	clearOverlayRect(pageNum, x, y, shpWidthScaled1, shapeHeight);
 
-	const uint8 *d = dst;
+	uint8 *d = dst;
 
 	while (shapeHeight--) {
 		while (!(scaleCounterV & 0xff00)) {
@@ -1438,10 +1438,7 @@
 			if (_dsTmpWidth) {
 				cnt += shpWidthScaled1;
 				if (cnt > 0) {
-					// very ugly hack to pass non const version of d
-					uint8 *tempDst = const_cast<uint8*>(d);
-					(this->*_dsProcessLine)(tempDst, s, cnt, scaleState);
-					d = tempDst;
+					(this->*_dsProcessLine)(d, s, cnt, scaleState);
 				}
 				cnt += _dsOffscreenRight;
 				if (cnt)
@@ -1456,7 +1453,7 @@
 	va_end(args);
 }
 
-int Screen::drawShapeMarginNoScaleUpwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
+int Screen::drawShapeMarginNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) {
 	while (cnt-- > 0) {
 		if (*src++)
 			continue;
@@ -1468,7 +1465,7 @@
 	return 0;
 }
 
-int Screen::drawShapeMarginNoScaleDownwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
+int Screen::drawShapeMarginNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt) {
 	while (cnt-- > 0) {
 		if (*src++)
 			continue;
@@ -1480,7 +1477,7 @@
 	return 0;
 }
 
-int Screen::drawShapeMarginScaleUpwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
+int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) {
 	_dsTmpWidth -= cnt;
 	bool found = false;
 
@@ -1509,7 +1506,7 @@
 	return res;
 }
 
-int Screen::drawShapeMarginScaleDownwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
+int Screen::drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt) {
 	_dsTmpWidth -= cnt;
 	bool found = false;
 
@@ -1538,7 +1535,7 @@
 	return res;
 }
 
-int Screen::drawShapeSkipScaleUpwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
+int Screen::drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) {
 	cnt = _dsTmpWidth;
 
 	if (cnt <= 0)
@@ -1553,7 +1550,7 @@
 	return 0;
 }
 
-int Screen::drawShapeSkipScaleDownwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
+int Screen::drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt) {
 	cnt = _dsTmpWidth;
 	bool found = false;
 

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2008-03-30 02:43:18 UTC (rev 31316)
+++ scummvm/trunk/engines/kyra/screen.h	2008-03-30 02:43:22 UTC (rev 31317)
@@ -180,12 +180,12 @@
 
 	void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...);
 
-	int drawShapeMarginNoScaleUpwind(const uint8 *&dst, const uint8 *&src, int &cnt);
-	int drawShapeMarginNoScaleDownwind(const uint8 *&dst, const uint8 *&src, int &cnt);
-	int drawShapeMarginScaleUpwind(const uint8 *&dst, const uint8 *&src, int &cnt);
-	int drawShapeMarginScaleDownwind(const uint8 *&dst, const uint8 *&src, int &cnt);
-	int drawShapeSkipScaleUpwind(const uint8 *&dst, const uint8 *&src, int &cnt);
-	int drawShapeSkipScaleDownwind(const uint8 *&dst, const uint8 *&src, int &cnt);
+	int drawShapeMarginNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt);
+	int drawShapeMarginNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt);
+	int drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt);
+	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);
@@ -199,7 +199,7 @@
 	void drawShapePlotType13(uint8 *dst, uint8 cmd);
 	void drawShapePlotType14(uint8 *dst, uint8 cmd);
 
-	typedef int (Screen::*DsMarginSkipFunc)(const uint8 *&dst, const uint8 *&src, int &cnt);
+	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::*DsPlotFunc)(uint8 *dst, uint8 cmd);
 


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