[Scummvm-cvs-logs] SF.net SVN: scummvm:[55393] scummvm/trunk/engines/toon

sylvaintv at users.sourceforge.net sylvaintv at users.sourceforge.net
Fri Jan 21 21:26:25 CET 2011


Revision: 55393
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55393&view=rev
Author:   sylvaintv
Date:     2011-01-21 20:26:25 +0000 (Fri, 21 Jan 2011)

Log Message:
-----------
TOON: Fix all the glitches in smacker video playback

Handle manually 2x scaling when it is needed now.

Modified Paths:
--------------
    scummvm/trunk/engines/toon/movie.cpp
    scummvm/trunk/engines/toon/movie.h

Modified: scummvm/trunk/engines/toon/movie.cpp
===================================================================
--- scummvm/trunk/engines/toon/movie.cpp	2011-01-21 20:08:11 UTC (rev 55392)
+++ scummvm/trunk/engines/toon/movie.cpp	2011-01-21 20:26:25 UTC (rev 55393)
@@ -33,8 +33,7 @@
 	if (track == 1 && chunkSize == 4) {
 		/* uint16 width = */ _fileStream->readUint16LE();
 		uint16 height = _fileStream->readUint16LE();
-
-		_header.flags = (height == getHeight() / 2) ? 4 : 0;
+		_lowRes = (height == getHeight() / 2);
 	} else
 		Graphics::SmackerDecoder::handleAudioTrack(track, chunkSize, unpackedSize);
 }
@@ -44,21 +43,25 @@
 
 	if (Graphics::SmackerDecoder::loadFile(filename)) {
 		if (forcedflags & 0x10 || _surface->h == 200) {
-
-			_header.flags = 4;
 			if (_surface) {
 				_surface->free();
 				delete _surface;
 			}
 			_surface = new Graphics::Surface();
 			_surface->create(640, 400, 1);
+			_lowRes = false;
+			_header.flags = 4;
 		}
+
 		return true;
 	}
+	
+
 	return false;
 }
 
 ToonstruckSmackerDecoder::ToonstruckSmackerDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundType) : Graphics::SmackerDecoder(mixer, soundType) {
+	_lowRes = false;
 }
 
 // decoder is deallocated with Movie destruction i.e. new ToonstruckSmackerDecoder is needed
@@ -98,8 +101,19 @@
 	while (!_vm->shouldQuit() && !_decoder->endOfVideo()) {
 		if (_decoder->needsUpdate()) {
 			const Graphics::Surface *frame = _decoder->decodeNextFrame();
-			if (frame)
-				_vm->getSystem()->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+			if (frame) {
+				if (_decoder->isLowRes()) {
+					// handle manually 2x scaling here
+					Graphics::Surface* surf = _vm->getSystem()->lockScreen();
+					for (int y = 0; y < frame->h/2; y++) {
+						memcpy(surf->getBasePtr(0, y*2+0), frame->getBasePtr(0, y), frame->pitch);
+						memcpy(surf->getBasePtr(0, y*2+1), frame->getBasePtr(0, y), frame->pitch);
+					}
+					_vm->getSystem()->unlockScreen();
+				} else {
+					_vm->getSystem()->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+				}
+			}
 			_decoder->setSystemPalette();
 			_vm->getSystem()->updateScreen();
 		}

Modified: scummvm/trunk/engines/toon/movie.h
===================================================================
--- scummvm/trunk/engines/toon/movie.h	2011-01-21 20:08:11 UTC (rev 55392)
+++ scummvm/trunk/engines/toon/movie.h	2011-01-21 20:26:25 UTC (rev 55393)
@@ -37,6 +37,9 @@
 	virtual ~ToonstruckSmackerDecoder() {}
 	void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize);
 	bool loadFile(const Common::String &filename, int forcedflags) ;
+	bool isLowRes() { return _lowRes; }
+protected:
+	bool _lowRes;
 };
 
 class Movie {
@@ -54,7 +57,6 @@
 	Audio::Mixer *_mixer;
 	ToonstruckSmackerDecoder *_decoder;
 	bool _playing;
-	
 };
 
 } // End of namespace Toon


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