aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-23 10:03:59 -0400
committerMatthew Hoops2011-05-23 10:03:59 -0400
commit45f9720f7c9f9b2b189ee74c2b167794a8a613f8 (patch)
treefc0239534aacae8693a8177c2684a1b2ea59e611
parent252e7a1ec323fc6cccb91dbdcae92db7efd851a6 (diff)
downloadscummvm-rg350-45f9720f7c9f9b2b189ee74c2b167794a8a613f8.tar.gz
scummvm-rg350-45f9720f7c9f9b2b189ee74c2b167794a8a613f8.tar.bz2
scummvm-rg350-45f9720f7c9f9b2b189ee74c2b167794a8a613f8.zip
SWORD25: Properly use Theora picture offset/dimensions
-rw-r--r--engines/sword25/fmv/theora_decoder.cpp21
-rw-r--r--engines/sword25/fmv/theora_decoder.h9
2 files changed, 18 insertions, 12 deletions
diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp
index 07cb56356d..18f12607a5 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 10a05647c3..e8cc5ab8b9 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;