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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Aug 8 03:02:19 CEST 2010


Revision: 51909
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51909&view=rev
Author:   drmccoy
Date:     2010-08-08 01:02:19 +0000 (Sun, 08 Aug 2010)

Log Message:
-----------
VIDEO/GOB: Implement and use CoktelDecoder::getFrameCoords()

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 01:01:45 UTC (rev 51908)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2010-08-08 01:02:19 UTC (rev 51909)
@@ -494,10 +494,8 @@
 		width = video.decoder->getWidth();
 		width = video.decoder->getHeight();
 
-		/*
 		if (VAR_OFFSET(varX) == 0xFFFFFFFF)
 			video.decoder->getFrameCoords(1, x, y, width, height);
-		*/
 
 		WRITE_VAR_OFFSET(varX     , x);
 		WRITE_VAR_OFFSET(varY     , y);

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-08-08 01:01:45 UTC (rev 51908)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-08-08 01:02:19 UTC (rev 51909)
@@ -205,6 +205,10 @@
 	_audioStream  = 0;
 }
 
+bool CoktelDecoder::getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) {
+	return false;
+}
+
 bool CoktelDecoder::hasEmbeddedFiles() const {
 	return false;
 }
@@ -2332,6 +2336,38 @@
 	return PixelFormat::createFormatCLUT8();
 }
 
+bool VMDDecoder::getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height) {
+	if (frame >= ((int32) _frameCount))
+		return false;
+
+	Frame &f = _frames[frame];
+
+	// Look for a part matching the requested type, stopping at a separator
+	Part *part = 0;
+	for (int i = 0; i < _partsPerFrame; i++) {
+		Part &p = f.parts[i];
+
+		if ((p.type == kPartTypeSeparator) || (p.type == type)) {
+			part = &p;
+			break;
+		}
+	}
+
+	if (!part)
+		return false;
+
+	x      = part->left;
+	y      = part->top;
+	width  = part->right  - part->left + 1;
+	height = part->bottom - part->top  + 1;
+
+	return true;
+}
+
+bool VMDDecoder::getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) {
+	return getPartCoords(frame, kPartTypeVideo, x, y, width, height);
+}
+
 bool VMDDecoder::hasEmbeddedFiles() const {
 	return !_files.empty();
 }

Modified: scummvm/trunk/graphics/video/coktel_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.h	2010-08-08 01:01:45 UTC (rev 51908)
+++ scummvm/trunk/graphics/video/coktel_decoder.h	2010-08-08 01:02:19 UTC (rev 51909)
@@ -98,6 +98,9 @@
 	void enableSound();
 	void disableSound();
 
+	/** Return the coordinates of the specified frame. */
+	bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
+
 	/** Return whether that video has any embedded files. */
 	virtual bool hasEmbeddedFiles() const;
 
@@ -340,6 +343,8 @@
 
 	bool seek(int32 frame, int whence = SEEK_SET, bool restart = false);
 
+	bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
+
 	bool hasEmbeddedFiles() const;
 	bool hasEmbeddedFile(const Common::String &fileName) const;
 	Common::MemoryReadStream *getEmbeddedFile(const Common::String &fileName) const;
@@ -480,6 +485,8 @@
 	// Sound decompression
 	byte *deDPCM (const byte *data, uint32 &size, int32 init[2]);
 	byte *deADPCM(const byte *data, uint32 &size, int32 init, int32 index);
+
+	bool getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height);
 };
 
 } // End of namespace Graphics


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