[Scummvm-git-logs] scummvm master -> d839d193cc24566456f48fa487a025f65656d2db

dreammaster dreammaster at scummvm.org
Fri Sep 30 02:35:51 CEST 2016


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

Summary:
019eda55fc GRAPHICS: Added a PixelFormat bpp method
d839d193cc TITANIC: Match AVISurface setup and frame rendering closer to original


Commit: 019eda55fcb9117aef44d64d140ad451db6c9fcc
    https://github.com/scummvm/scummvm/commit/019eda55fcb9117aef44d64d140ad451db6c9fcc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-29T20:35:05-04:00

Commit Message:
GRAPHICS: Added a PixelFormat bpp method

Changed paths:
    graphics/pixelformat.h



diff --git a/graphics/pixelformat.h b/graphics/pixelformat.h
index 9dd0624..7b966a8 100644
--- a/graphics/pixelformat.h
+++ b/graphics/pixelformat.h
@@ -215,6 +215,10 @@ struct PixelFormat {
 		return (8 - aLoss);
 	}
 
+	inline byte bpp() const {
+		return rBits() + gBits() + bBits() + aBits();
+	}
+
 	////////////////////////////////////////////////////////////////////////
 	// Convenience functions for getting color components' maximum values //
 	////////////////////////////////////////////////////////////////////////


Commit: d839d193cc24566456f48fa487a025f65656d2db
    https://github.com/scummvm/scummvm/commit/d839d193cc24566456f48fa487a025f65656d2db
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-29T20:35:42-04:00

Commit Message:
TITANIC: Match AVISurface setup and frame rendering closer to original

Changed paths:
    engines/titanic/support/avi_surface.cpp
    engines/titanic/support/avi_surface.h



diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index 2cc3297..7fbb05e 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -58,6 +58,7 @@ AVISurface::AVISurface(const CResourceKey &key) {
 	_videoSurface = nullptr;
 	_streamCount = 0;
 	_movieFrameSurface[0] = _movieFrameSurface[1] = nullptr;
+	_framePixels = nullptr;
 
 	// Reset current frame. We need to keep track of frames separately from the decoders,
 	// since it needs to be able to go beyond the frame count or to negative to allow
@@ -86,6 +87,7 @@ AVISurface::AVISurface(const CResourceKey &key) {
 AVISurface::~AVISurface() {
 	if (_videoSurface)
 		_videoSurface->_transBlitFlag = false;
+	delete _framePixels;
 	delete _movieFrameSurface[0];
 	delete _movieFrameSurface[1];
 	delete _decoders[0];
@@ -257,11 +259,37 @@ void AVISurface::setupDecompressor() {
 
 		// Setup frame surface
 		_movieFrameSurface[idx] = new Graphics::ManagedSurface(decoder.getWidth(), decoder.getHeight(),
-			g_system->getScreenFormat());
+			decoder.getVideoTrack().getPixelFormat());
 
-		// TODO: See whether this simplified form of original works
-		if (idx == 1)
+		bool flag = false;
+		if (idx == 0 && _videoSurface) {
+			const Graphics::PixelFormat &ff = decoder.getVideoTrack().getPixelFormat();
+			const int vDepth = _videoSurface->getPixelDepth();
+
+			switch (ff.bpp()) {
+			case 15:
+				flag = vDepth == 1;
+				break;
+
+			case 16:
+				flag = vDepth == 1 || vDepth == 2;
+				break;
+
+			case 24:
+				flag = vDepth == 3;
+				break;
+
+			default:
+				break;
+			}
+		}
+
+		if (!flag) {
+			_framePixels = new Graphics::ManagedSurface(decoder.getWidth(), decoder.getHeight(),
+				decoder.getVideoTrack().getPixelFormat());
+		} else if (idx == 0) {
 			_videoSurface->_transBlitFlag = true;
+		}
 	}
 }
 
@@ -295,26 +323,33 @@ bool AVISurface::renderFrame() {
 	if (!_decoders[0]->needsUpdate())
 		return false;
 
-	// Decode each decoder's video stream into the appropriate surface
+	// Make a copy of each decoder's video frame
 	for (int idx = 0; idx < _streamCount; ++idx) {
 		const Graphics::Surface *frame = _decoders[idx]->decodeNextFrame();
-			
-		if (_movieFrameSurface[idx]->format == frame->format) {
-			_movieFrameSurface[idx]->blitFrom(*frame);
-		} else {
-			// Format mis-match, so we need to convert the frame
-			Graphics::Surface *s = frame->convertTo(_movieFrameSurface[idx]->format,
-				_decoders[idx]->getPalette());
-			_movieFrameSurface[idx]->blitFrom(*s);
-			s->free();
-			delete s;
-		}
+
+		assert(_movieFrameSurface[idx]->format == frame->format);
+		_movieFrameSurface[idx]->blitFrom(*frame);
 	}
 
-	// Blit the primary video frame onto the main overall surface
-	_videoSurface->lock();
-	_videoSurface->getRawSurface()->blitFrom(*_movieFrameSurface[0]);
-	_videoSurface->unlock();
+	if (!_framePixels) {
+		if (_videoSurface->lock()) {
+			if (_streamCount == 1) {
+				// Original seems to call a stubbed empty method here.
+				// Likely this form of blitting to surface wasn't needed
+			}
+
+			_videoSurface->unlock();
+		}
+	} else {
+		// Blit the primary video track's frame to the video surface
+		Graphics::Surface *s = _movieFrameSurface[0]->rawSurface().convertTo(
+			g_system->getScreenFormat(), _decoders[0]->getPalette());
+		_videoSurface->lock();
+		_videoSurface->getRawSurface()->blitFrom(*s);
+		_videoSurface->unlock();
+		s->free();
+		delete s;
+	}
 
 	return false;
 }
diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h
index 0acf7ab..c0cf0af 100644
--- a/engines/titanic/support/avi_surface.h
+++ b/engines/titanic/support/avi_surface.h
@@ -55,6 +55,7 @@ private:
 	CMovieRangeInfoList _movieRangeInfo;
 	int _streamCount;
 	Graphics::ManagedSurface *_movieFrameSurface[2];
+	Graphics::ManagedSurface *_framePixels;
 	bool _isReversed;
 	int _currentFrame;
 private:





More information about the Scummvm-git-logs mailing list