[Scummvm-cvs-logs] SF.net SVN: scummvm:[43633] scummvm/trunk/engines/scumm/he

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Sat Aug 22 11:39:56 CEST 2009


Revision: 43633
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43633&view=rev
Author:   Kirben
Date:     2009-08-22 09:39:55 +0000 (Sat, 22 Aug 2009)

Log Message:
-----------
Fix endian issue in copyFrameToBuffer().

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/he/animation_he.cpp
    scummvm/trunk/engines/scumm/he/animation_he.h

Modified: scummvm/trunk/engines/scumm/he/animation_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/animation_he.cpp	2009-08-22 09:22:23 UTC (rev 43632)
+++ scummvm/trunk/engines/scumm/he/animation_he.cpp	2009-08-22 09:39:55 UTC (rev 43633)
@@ -66,7 +66,7 @@
 	return 0;
 }
 
-void MoviePlayer::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
+void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint pitch) {
 	uint h = getHeight();
 	uint w = getWidth();
 
@@ -76,8 +76,17 @@
 		dst += y * pitch + x * 2;
 		do {
 			for (uint i = 0; i < w; i++) {
-				uint16 col = READ_LE_UINT16(_vm->_hePalettes + _vm->_hePaletteSlot + 768 + src[i] * 2);
-				WRITE_UINT16(dst + i * 2, col);
+				uint16 color = READ_LE_UINT16(_vm->_hePalettes + _vm->_hePaletteSlot + 768 + src[i] * 2);
+				switch (dstType) {
+				case kDstScreen:
+					WRITE_UINT16(dst + i * 2, color);
+					break;
+				case kDstResource:
+					WRITE_LE_UINT16(dst + i * 2, color);
+					break;
+				default:
+					error("copyFrameToBuffer: Unknown dstType %d", dstType);
+				}
 			}
 			dst += pitch;
 			src += w;
@@ -106,14 +115,14 @@
 		assert(dstPtr);
 		uint8 *dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
 		assert(dst);
-		copyFrameToBuffer(dst, 0, 0, _vm->_screenWidth * _vm->_bitDepth);
+		copyFrameToBuffer(dst, kDstResource, 0, 0, _vm->_screenWidth * _vm->_bitDepth);
 	} else if (_flags & 1) {
-		copyFrameToBuffer(pvs->getBackPixels(0, 0), 0, 0, pvs->pitch);
+		copyFrameToBuffer(pvs->getBackPixels(0, 0), kDstScreen, 0, 0, pvs->pitch);
 
 		Common::Rect imageRect(getWidth(), getHeight());
 		_vm->restoreBackgroundHE(imageRect);
 	} else {
-		copyFrameToBuffer(pvs->getPixels(0, 0), 0, 0, pvs->pitch);
+		copyFrameToBuffer(pvs->getPixels(0, 0), kDstScreen, 0, 0, pvs->pitch);
 
 		Common::Rect imageRect(getWidth(), getHeight());
 		_vm->markRectAsDirty(kMainVirtScreen, imageRect);

Modified: scummvm/trunk/engines/scumm/he/animation_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/animation_he.h	2009-08-22 09:22:23 UTC (rev 43632)
+++ scummvm/trunk/engines/scumm/he/animation_he.h	2009-08-22 09:39:55 UTC (rev 43633)
@@ -54,7 +54,7 @@
 	int getImageNum();
 	int load(const char *filename, int flags, int image = 0);
 
-	void copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch);
+	void copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint pitch);
 	void handleNextFrame();
 
 protected:


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