[Scummvm-cvs-logs] SF.net SVN: scummvm:[46279] scummvm/trunk/engines/m4

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Dec 7 19:20:20 CET 2009


Revision: 46279
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46279&view=rev
Author:   fingolfin
Date:     2009-12-07 18:20:20 +0000 (Mon, 07 Dec 2009)

Log Message:
-----------
M4: Rename M4Surface::getData() to getBasePtr() for consistency

Modified Paths:
--------------
    scummvm/trunk/engines/m4/assets.cpp
    scummvm/trunk/engines/m4/events.cpp
    scummvm/trunk/engines/m4/graphics.cpp
    scummvm/trunk/engines/m4/graphics.h
    scummvm/trunk/engines/m4/sprite.cpp

Modified: scummvm/trunk/engines/m4/assets.cpp
===================================================================
--- scummvm/trunk/engines/m4/assets.cpp	2009-12-07 16:21:33 UTC (rev 46278)
+++ scummvm/trunk/engines/m4/assets.cpp	2009-12-07 18:20:20 UTC (rev 46279)
@@ -158,7 +158,7 @@
 			char fn[512];
 			sprintf(fn, "%04d.raw", curFrame);
 			FILE *h = fopen(fn, "wb");
-			fwrite((byte*)frame.frame->getData(), frame.w * frame.h, 1, h);
+			fwrite((byte*)frame.frame->getBasePtr(), frame.w * frame.h, 1, h);
 			fclose(h);
 #endif
 		}

Modified: scummvm/trunk/engines/m4/events.cpp
===================================================================
--- scummvm/trunk/engines/m4/events.cpp	2009-12-07 16:21:33 UTC (rev 46278)
+++ scummvm/trunk/engines/m4/events.cpp	2009-12-07 18:20:20 UTC (rev 46279)
@@ -240,7 +240,7 @@
 	_cursor = _cursorSprites->getFrame(cursorIndex);
 
 	// Set the cursor to the sprite
-	CursorMan.replaceCursor((const byte *)_cursor->getData(), _cursor->w, _cursor->h, _cursor->xOffset, _cursor->yOffset, 0);
+	CursorMan.replaceCursor((const byte *)_cursor->getBasePtr(), _cursor->w, _cursor->h, _cursor->xOffset, _cursor->yOffset, 0);
 
 	return true;
 }

Modified: scummvm/trunk/engines/m4/graphics.cpp
===================================================================
--- scummvm/trunk/engines/m4/graphics.cpp	2009-12-07 16:21:33 UTC (rev 46278)
+++ scummvm/trunk/engines/m4/graphics.cpp	2009-12-07 18:20:20 UTC (rev 46279)
@@ -216,7 +216,7 @@
 		return;
 	int heightAmt = scaledHeight;
 
-	byte *src = info.sprite->getData();
+	byte *src = info.sprite->getBasePtr();
 	byte *dst = getBasePtr(x - info.hotX - clipX, y - info.hotY - clipY);
 
 	int status = kStatusSkip;
@@ -309,19 +309,11 @@
 
 // Surface methods
 
-byte *M4Surface::getData() {
-	return (byte *)pixels;
-}
-
-byte *M4Surface::getBasePtr(int x, int y) {
-	return (byte *)Graphics::Surface::getBasePtr(x, y);
-}
-
 void M4Surface::freeData() {
 }
 
 void M4Surface::clear() {
-	Common::set_to((byte *) pixels, (byte *) pixels + w * h, _vm->_palette->BLACK);
+	Common::set_to((byte *)pixels, (byte *)pixels + w * h, _vm->_palette->BLACK);
 }
 
 void M4Surface::frameRect(const Common::Rect &r, uint8 color) {
@@ -357,7 +349,7 @@
 
 	// Copy the specified area
 
-	byte *data = src->getData();
+	byte *data = src->getBasePtr();
 	byte *srcPtr = data + (src->width() * copyRect.top + copyRect.left);
 	byte *destPtr = (byte *)pixels + (destY * width()) + destX;
 
@@ -855,7 +847,7 @@
 
 	// Remap all pixels into the #32-63 range
 
-	tempP = _vm->_scene->getData();
+	tempP = _vm->_scene->getBasePtr();
 	for (int pixelCtr = 0; pixelCtr < _vm->_scene->width() * _vm->_scene->height();
 			++pixelCtr, ++tempP) {
 		// If pixel is in #32-63 range already, remap to higher palette entries

Modified: scummvm/trunk/engines/m4/graphics.h
===================================================================
--- scummvm/trunk/engines/m4/graphics.h	2009-12-07 16:21:33 UTC (rev 46278)
+++ scummvm/trunk/engines/m4/graphics.h	2009-12-07 18:20:20 UTC (rev 46279)
@@ -125,8 +125,15 @@
 	int width() { return w; }
 	int height() { return h; }
 	void setSize(int sizeX, int sizeY) { create(sizeX, sizeY, 1); }
-	byte *getData();
-	byte *getBasePtr(int x, int y);
+	inline byte *getBasePtr() {
+		return (byte *)pixels;
+	}
+	inline byte *getBasePtr(int x, int y) {
+		return (byte *)Graphics::Surface::getBasePtr(x, y);
+	}
+	inline const byte *getBasePtr(int x, int y) const {
+		return (const byte *)Graphics::Surface::getBasePtr(x, y);
+	}
 	void freeData();
 	void clear();
 	void frameRect(const Common::Rect &r, uint8 color);

Modified: scummvm/trunk/engines/m4/sprite.cpp
===================================================================
--- scummvm/trunk/engines/m4/sprite.cpp	2009-12-07 16:21:33 UTC (rev 46278)
+++ scummvm/trunk/engines/m4/sprite.cpp	2009-12-07 18:20:20 UTC (rev 46279)
@@ -47,7 +47,7 @@
 			loadRle(source);
 		} else {
 			// Raw sprite data, load directly
-			byte *dst = getData();
+			byte *dst = getBasePtr();
 			source->read(dst, widthVal * heightVal);
 		}
 	} else {
@@ -60,7 +60,7 @@
 }
 
 void M4Sprite::loadRle(Common::SeekableReadStream* rleData) {
-	byte *dst = getData();
+	byte *dst = getBasePtr();
 	while (1) {
 		byte len = rleData->readByte();
 		if (len == 0) {
@@ -124,8 +124,8 @@
 	byte *outp, *lineStart;
 	bool newLine = false;
 
-	outp = getData();
-	lineStart = getData();
+	outp = getBasePtr();
+	lineStart = getBasePtr();
 
 	while (1) {
 		byte cmd1, cmd2, count, pixel;


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