[Scummvm-cvs-logs] scummvm master -> 19d634389dc92c32112b13807b6a266ede7c0422

clone2727 clone2727 at gmail.com
Sun Apr 15 22:03:26 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:
19d634389d VIDEO: Create the QuickTime scaled surface after reading in a frame


Commit: 19d634389dc92c32112b13807b6a266ede7c0422
    https://github.com/scummvm/scummvm/commit/19d634389dc92c32112b13807b6a266ede7c0422
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-04-15T13:00:01-07:00

Commit Message:
VIDEO: Create the QuickTime scaled surface after reading in a frame

Fixes issues where the codec hasn't been initialized

Changed paths:
    video/qt_decoder.cpp



diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index df83961..0d80c93 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -152,7 +152,13 @@ const Graphics::Surface *QuickTimeDecoder::decodeNextFrame() {
 	// (needs to be done after we find the next track)
 	updateAudioBuffer();
 
-	if (_scaledSurface) {
+	// We have to initialize the scaled surface
+	if (frame && (_scaleFactorX != 1 || _scaleFactorY != 1)) {
+		if (!_scaledSurface) {
+			_scaledSurface = new Graphics::Surface();
+			_scaledSurface->create(_width, _height, getPixelFormat());
+		}
+
 		scaleSurface(frame, _scaledSurface, _scaleFactorX, _scaleFactorY);
 		return _scaledSurface;
 	}
@@ -258,14 +264,10 @@ void QuickTimeDecoder::init() {
 	_nextVideoTrack = findNextVideoTrack();
 
 	if (_nextVideoTrack) {
-		// Initialize the scaled surface
 		if (_scaleFactorX != 1 || _scaleFactorY != 1) {
-			// We have to initialize the scaled surface
-			_scaledSurface = new Graphics::Surface();
-			_scaledSurface->create((_nextVideoTrack->getWidth() / _scaleFactorX).toInt(),
-					(_nextVideoTrack->getHeight() / _scaleFactorY).toInt(), getPixelFormat());
-			_width = _scaledSurface->w;
-			_height = _scaledSurface->h;
+			// We have to take the scale into consideration when setting width/height
+			_width = (_nextVideoTrack->getWidth() / _scaleFactorX).toInt();
+			_height = (_nextVideoTrack->getHeight() / _scaleFactorY).toInt();
 		} else {
 			_width = _nextVideoTrack->getWidth().toInt();
 			_height = _nextVideoTrack->getHeight().toInt();
@@ -527,19 +529,12 @@ void QuickTimeDecoder::AudioTrackHandler::seekToTime(Audio::Timestamp time) {
 }
 
 QuickTimeDecoder::VideoTrackHandler::VideoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent) : TrackHandler(decoder, parent) {
-	if (_parent->scaleFactorX != 1 || _parent->scaleFactorY != 1) {
-		_scaledSurface = new Graphics::Surface();
-		_scaledSurface->create(getWidth().toInt(), getHeight().toInt(), getPixelFormat());
-	} else {
-		_scaledSurface = 0;
-	}
-
 	enterNewEditList(false);
 
 	_holdNextFrameStartTime = false;
 	_curFrame = -1;
 	_durationOverride = -1;
-
+	_scaledSurface = 0;
 }
 
 QuickTimeDecoder::VideoTrackHandler::~VideoTrackHandler() {
@@ -576,7 +571,12 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame()
 			enterNewEditList(true);
 	}
 
-	if (_scaledSurface) {
+	if (frame && (_parent->scaleFactorX != 1 || _parent->scaleFactorY != 1)) {
+		if (!_scaledSurface) {
+			_scaledSurface = new Graphics::Surface();
+			_scaledSurface->create(getWidth().toInt(), getHeight().toInt(), getPixelFormat());
+		}
+
 		_decoder->scaleSurface(frame, _scaledSurface, _parent->scaleFactorX, _parent->scaleFactorY);
 		return _scaledSurface;
 	}






More information about the Scummvm-git-logs mailing list