[Scummvm-cvs-logs] scummvm master -> 45f9720f7c9f9b2b189ee74c2b167794a8a613f8

clone2727 clone2727 at gmail.com
Mon May 23 16:07:15 CEST 2011


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:
45f9720f7c SWORD25: Properly use Theora picture offset/dimensions


Commit: 45f9720f7c9f9b2b189ee74c2b167794a8a613f8
    https://github.com/scummvm/scummvm/commit/45f9720f7c9f9b2b189ee74c2b167794a8a613f8
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-05-23T07:03:59-07:00

Commit Message:
SWORD25: Properly use Theora picture offset/dimensions

Changed paths:
    engines/sword25/fmv/theora_decoder.cpp
    engines/sword25/fmv/theora_decoder.h



diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp
index 07cb563..18f1260 100644
--- a/engines/sword25/fmv/theora_decoder.cpp
+++ b/engines/sword25/fmv/theora_decoder.cpp
@@ -54,7 +54,6 @@ static double rint(double v) {
 
 TheoraDecoder::TheoraDecoder(Audio::Mixer::SoundType soundType) {
 	_fileStream = 0;
-	_surface = 0;
 
 	_theoraPacket = 0;
 	_vorbisPacket = 0;
@@ -298,8 +297,14 @@ bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) {
 		_endOfAudio = true;
 	}
 
-	_surface = new Graphics::Surface();
-	_surface->create(_theoraInfo.frame_width, _theoraInfo.frame_height, g_system->getScreenFormat());
+	_surface.create(_theoraInfo.frame_width, _theoraInfo.frame_height, g_system->getScreenFormat());
+
+	// Set up a display surface
+	_displaySurface.pixels = _surface.getBasePtr(_theoraInfo.pic_x, _theoraInfo.pic_y);
+	_displaySurface.w = _theoraInfo.pic_width;
+	_displaySurface.h = _theoraInfo.pic_height;
+	_displaySurface.format = _surface.format;
+	_displaySurface.pitch = _surface.pitch;
 
 	// Set the frame rate
 	_frameRate = Common::Rational(_theoraInfo.fps_numerator, _theoraInfo.fps_denominator);
@@ -337,9 +342,9 @@ void TheoraDecoder::close() {
 	delete _fileStream;
 	_fileStream = 0;
 
-	_surface->free();
-	delete _surface;
-	_surface = 0;
+	_surface.free();
+	_displaySurface.pixels = 0;
+	_displaySurface.free();
 
 	reset();
 }
@@ -412,7 +417,7 @@ const Graphics::Surface *TheoraDecoder::decodeNextFrame() {
 		}
 	}
 
-	return _surface;
+	return &_displaySurface;
 }
 
 bool TheoraDecoder::queueAudio() {
@@ -533,7 +538,7 @@ void TheoraDecoder::translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer) {
 	assert(YUVBuffer[kBufferU].height == YUVBuffer[kBufferY].height >> 1);
 	assert(YUVBuffer[kBufferV].height == YUVBuffer[kBufferY].height >> 1);
 
-	Graphics::convertYUV420ToRGB(_surface, YUVBuffer[kBufferY].data, YUVBuffer[kBufferU].data, YUVBuffer[kBufferV].data, YUVBuffer[kBufferY].width, YUVBuffer[kBufferY].height, YUVBuffer[kBufferY].stride, YUVBuffer[kBufferU].stride);
+	Graphics::convertYUV420ToRGB(&_surface, YUVBuffer[kBufferY].data, YUVBuffer[kBufferU].data, YUVBuffer[kBufferV].data, YUVBuffer[kBufferY].width, YUVBuffer[kBufferY].height, YUVBuffer[kBufferY].stride, YUVBuffer[kBufferU].stride);
 }
 
 } // End of namespace Sword25
diff --git a/engines/sword25/fmv/theora_decoder.h b/engines/sword25/fmv/theora_decoder.h
index 10a0564..e8cc5ab 100644
--- a/engines/sword25/fmv/theora_decoder.h
+++ b/engines/sword25/fmv/theora_decoder.h
@@ -70,8 +70,8 @@ public:
 	const Graphics::Surface *decodeNextFrame();
 
 	bool isVideoLoaded() const { return _fileStream != 0; }
-	uint16 getWidth() const { return _surface->w; }
-	uint16 getHeight() const { return _surface->h; }
+	uint16 getWidth() const { return _displaySurface.w; }
+	uint16 getHeight() const { return _displaySurface.h; }
 
 	uint32 getFrameCount() const {
 		// It is not possible to get frame count easily
@@ -80,7 +80,7 @@ public:
 		return 0;
 	}
 
-	Graphics::PixelFormat getPixelFormat() const { return _surface->format; }
+	Graphics::PixelFormat getPixelFormat() const { return _displaySurface.format; }
 	uint32 getElapsedTime() const;
 	uint32 getTimeToNextFrame() const;
 
@@ -96,7 +96,8 @@ private:
 	void translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer);
 
 	Common::SeekableReadStream *_fileStream;
-	Graphics::Surface *_surface;
+	Graphics::Surface _surface;
+	Graphics::Surface _displaySurface;
 	Common::Rational _frameRate;
 	double _nextFrameStartTime;
 	bool _endOfVideo;






More information about the Scummvm-git-logs mailing list