[Scummvm-cvs-logs] scummvm master -> 3919c51e865b6b895447d94861def0444887daa2

bluegr bluegr at gmail.com
Fri Sep 14 10:42:06 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3919c51e86 TOLTECS: Adapt the movie chunk buffer allocation code


Commit: 3919c51e865b6b895447d94861def0444887daa2
    https://github.com/scummvm/scummvm/commit/3919c51e865b6b895447d94861def0444887daa2
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-09-14T01:40:27-07:00

Commit Message:
TOLTECS: Adapt the movie chunk buffer allocation code

Thanks to wjp and LordHoto for their feedback

Changed paths:
    engines/toltecs/movie.cpp



diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp
index 33fe249..7436463 100644
--- a/engines/toltecs/movie.cpp
+++ b/engines/toltecs/movie.cpp
@@ -98,7 +98,7 @@ void MoviePlayer::playMovie(uint resIndex) {
 
 	uint32 lastTime = _vm->_mixer->getSoundElapsedTime(_audioStreamHandle);
 	byte *chunkBuffer = NULL;
-	uint32 prevChunkSize = 0;
+	uint32 chunkBufferSize = 0;
 
 	while (_chunkCount--) {
 		byte chunkType = _vm->_arc->readByte();
@@ -111,13 +111,13 @@ void MoviePlayer::playMovie(uint resIndex) {
 		if (chunkType == kChunkAudio) {
 			_vm->_arc->skip(chunkSize);
 		} else {
-			// Only reallocate the chunk buffer if it's smaller than the previous frame
-			if (chunkSize > prevChunkSize) {
+			// Only reallocate the chunk buffer if the new chunk is bigger
+			if (chunkSize > chunkBufferSize) {
 				delete[] chunkBuffer;
 				chunkBuffer = new byte[chunkSize];
+				chunkBufferSize = chunkSize;
 			}
 
-			prevChunkSize = chunkSize;
 			_vm->_arc->read(chunkBuffer, chunkSize);
 		}
 






More information about the Scummvm-git-logs mailing list