[Scummvm-cvs-logs] SF.net SVN: scummvm:[51858] scummvm/trunk

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Aug 8 02:38:27 CEST 2010


Revision: 51858
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51858&view=rev
Author:   drmccoy
Date:     2010-08-08 00:38:26 +0000 (Sun, 08 Aug 2010)

Log Message:
-----------
VIDEO/GOB: Add CoktelDecoder::setXY()

This allows for positioning the video within the video memory.

Modified Paths:
--------------
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/graphics/video/coktel_decoder.cpp
    scummvm/trunk/graphics/video/coktel_decoder.h

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2010-08-08 00:37:52 UTC (rev 51857)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2010-08-08 00:38:26 UTC (rev 51858)
@@ -137,23 +137,29 @@
 			properties.sprite = -1;
 			video->surface.reset();
 			video->decoder->setSurfaceMemory();
+			video->decoder->setXY(0, 0);
 		} else {
 			video->surface = _vm->_draw->_spritesArray[properties.sprite];
 			video->decoder->setSurfaceMemory(video->surface->getVidMem(),
 					video->surface->getWidth(), video->surface->getHeight(), 1);
+
+			if (!ownSurf || (ownSurf && screenSize))
+				video->decoder->setXY(properties.x, properties.y);
+			else
+				video->decoder->setXY(0, 0);
 		}
 
 	} else {
 		properties.sprite = -1;
 		video->surface.reset();
 		video->decoder->setSurfaceMemory();
+		video->decoder->setXY(0, 0);
 	}
 
 	if (primary)
 		_needBlit = (properties.flags & kFlagUseBackSurfaceContent) && (properties.sprite == Draw::kFrontSurface);
 
 	// video->decoder->setFrameRate(_vm->_util->getFrameRate());
-	// video->decoder->setXY(x, y);
 
 	WRITE_VAR(7, video->decoder->getFrameCount());
 
@@ -306,14 +312,18 @@
 
 		if (properties.sprite == Draw::kBackSurface) {
 
-			_vm->_draw->invalidateRect(0, 0, video->decoder->getWidth(), video->decoder->getHeight());
+			_vm->_draw->invalidateRect(properties.x, properties.y,
+					properties.x + video->decoder->getWidth(),
+					properties.y + video->decoder->getHeight());
 			_vm->_draw->blitInvalidated();
 
 			// if (!noRetrace)
 				_vm->_video->retrace();
 
 		} else if (properties.sprite == Draw::kFrontSurface) {
-			_vm->_video->dirtyRectsAdd(0, 0, video->decoder->getWidth(), video->decoder->getHeight());
+			_vm->_video->dirtyRectsAdd(properties.x, properties.y,
+					properties.x + video->decoder->getWidth(),
+					properties.y + video->decoder->getHeight());
 
 			// if (!noRetrace)
 				_vm->_video->retrace();

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-08-08 00:37:52 UTC (rev 51857)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-08-08 00:38:26 UTC (rev 51858)
@@ -34,7 +34,7 @@
 
 
 CoktelDecoder::CoktelDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType) :
-	_mixer(&mixer), _soundType(soundType), _width(0), _height(0), _frameCount(0),
+	_mixer(&mixer), _soundType(soundType), _width(0), _height(0), _x(0), _y(0), _frameCount(0),
 	_paletteDirty(false), _ownSurface(true) {
 
 	memset(_palette, 0, 768);
@@ -92,8 +92,18 @@
 	_ownSurface = true;
 }
 
+void CoktelDecoder::setXY(uint16 x, uint16 y) {
+	_x = x;
+	_y = y;
+}
+
 void CoktelDecoder::close() {
 	freeSurface();
+
+	_x = 0;
+	_y = 0;
+
+	_frameCount = 0;
 }
 
 uint16 CoktelDecoder::getWidth() const {
@@ -289,11 +299,11 @@
 }
 
 void PreIMDDecoder::renderFrame() {
-	uint16 w = MIN<uint16>(_surface.w, _width);
-	uint16 h = MIN<uint16>(_surface.h, _height);
+	uint16 w = CLIP<int32>(_surface.w - _x, 0, _width);
+	uint16 h = CLIP<int32>(_surface.h - _y, 0, _height);
 
 	const byte *src = _videoBuffer;
-	      byte *dst = (byte *) _surface.pixels; // + x/y
+	      byte *dst = (byte *) _surface.pixels + (_y * _surface.pitch) + _x;
 
 	uint32 frameDataSize = _videoBufferSize;
 

Modified: scummvm/trunk/graphics/video/coktel_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.h	2010-08-08 00:37:52 UTC (rev 51857)
+++ scummvm/trunk/graphics/video/coktel_decoder.h	2010-08-08 00:38:26 UTC (rev 51858)
@@ -69,6 +69,9 @@
 	/** Reset the video memory. */
 	void setSurfaceMemory();
 
+	/** Draw the video starting at this position within the video memory. */
+	void setXY(uint16 x, uint16 y);
+
 	// VideoDecoder interface
 
 	void close();
@@ -88,6 +91,9 @@
 	uint16 _width;
 	uint16 _height;
 
+	uint16 _x;
+	uint16 _y;
+
 	uint32 _frameCount;
 
 	byte _palette[768];


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