[Scummvm-cvs-logs] SF.net SVN: scummvm:[55344] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Jan 20 06:19:41 CET 2011


Revision: 55344
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55344&view=rev
Author:   drmccoy
Date:     2011-01-20 05:19:41 +0000 (Thu, 20 Jan 2011)

Log Message:
-----------
GOB: Use Surface::blit() in VideoPlayer::copyFrame()

Modified Paths:
--------------
    scummvm/trunk/engines/gob/inter_v6.cpp
    scummvm/trunk/engines/gob/scenery.cpp
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/engines/gob/videoplayer.h

Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp	2011-01-20 04:57:06 UTC (rev 55343)
+++ scummvm/trunk/engines/gob/inter_v6.cpp	2011-01-20 05:19:41 UTC (rev 55344)
@@ -244,10 +244,9 @@
 			props.waitEndFrame = false;
 
 			_vm->_vidPlayer->play(vmdSlot, props);
-			_vm->_vidPlayer->copyFrame(vmdSlot, _vm->_draw->_cursorSprites->getData(),
+			_vm->_vidPlayer->copyFrame(vmdSlot, *_vm->_draw->_cursorSprites,
 					0, 0, _vm->_draw->_cursorWidth, _vm->_draw->_cursorWidth,
-					(start + i) * _vm->_draw->_cursorWidth, 0,
-					_vm->_draw->_cursorSprites->getWidth() * 2, 2);
+					(start + i) * _vm->_draw->_cursorWidth, 0);
 		}
 
 		_vm->_vidPlayer->closeVideo(vmdSlot);

Modified: scummvm/trunk/engines/gob/scenery.cpp
===================================================================
--- scummvm/trunk/engines/gob/scenery.cpp	2011-01-20 04:57:06 UTC (rev 55343)
+++ scummvm/trunk/engines/gob/scenery.cpp	2011-01-20 05:19:41 UTC (rev 55344)
@@ -733,11 +733,10 @@
 				_vm->_draw->_spriteLeft = _vm->_vidPlayer->getWidth(obj.videoSlot - 1)  -
 					(destX + _vm->_draw->_spriteRight);
 
-			_vm->_vidPlayer->copyFrame(obj.videoSlot - 1, _vm->_draw->_backSurface->getData(),
+			_vm->_vidPlayer->copyFrame(obj.videoSlot - 1, *_vm->_draw->_backSurface,
 					_vm->_draw->_spriteLeft,  _vm->_draw->_spriteTop,
 					_vm->_draw->_spriteRight, _vm->_draw->_spriteBottom,
 					_vm->_draw->_destSpriteX, _vm->_draw->_destSpriteY,
-					_vm->_draw->_backSurface->getWidth(), 1,
 					(_vm->_draw->_transparency != 0) ? 0 : -1);
 
 			_vm->_draw->invalidateRect(_vm->_draw->_destSpriteX, _vm->_draw->_destSpriteY,

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2011-01-20 04:57:06 UTC (rev 55343)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2011-01-20 05:19:41 UTC (rev 55344)
@@ -611,9 +611,9 @@
 	}
 }
 
-bool VideoPlayer::copyFrame(int slot, byte *dest,
-		uint16 left, uint16 top, uint16 width, uint16 height,
-		uint16 x, uint16 y, uint16 pitch, uint8 bpp, int16 transp) const {
+bool VideoPlayer::copyFrame(int slot, Surface &dest,
+		uint16 left, uint16 top, uint16 width, uint16 height, uint16 x, uint16 y,
+		int32 transp) const {
 
 	const Video *video = getVideoBySlot(slot);
 	if (!video)
@@ -623,55 +623,9 @@
 	if (!surface)
 		return false;
 
-	assert(surface->bytesPerPixel == bpp);
+	Surface src(surface->w, surface->h, surface->bytesPerPixel, (byte *)surface->pixels);
 
-	int32 w = MIN<int32>(width , surface->w);
-	int32 h = MIN<int32>(height, surface->h);
-
-	const byte *src = (byte*)surface->pixels + (top * surface->pitch) + left;
-	      byte *dst =                   dest + (y   * pitch)          + x;
-
-	if (transp < 0) {
-		// No transparency
-
-		if ((x == 0) && (left == 0) && (pitch == surface->pitch) && (width == surface->w)) {
-			// Dimensions fit, we can copy everything at once
-
-			memcpy(dst, src, w * h * bpp);
-			return true;
-		}
-
-		// Copy row-by-row
-
-		while (h-- > 0) {
-			const byte *srcRow = src;
-						byte *dstRow = dst;
-
-			memcpy(dstRow, srcRow, w * bpp);
-
-			src += surface->pitch;
-			dst +=          pitch;
-		}
-
-		return true;
-	}
-
-	// Copy pixel-by-pixel
-
-	assert(bpp == 1);
-
-	while (h-- > 0) {
-		const byte *srcRow = src;
-		      byte *dstRow = dst;
-
-		for (int32 i = 0; i < w; i++, srcRow++, dstRow++)
-			if (*srcRow != transp)
-				*dstRow = *srcRow;
-
-		src += surface->pitch;
-		dst +=          pitch;
-	}
-
+	dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp);
 	return true;
 }
 

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2011-01-20 04:57:06 UTC (rev 55343)
+++ scummvm/trunk/engines/gob/videoplayer.h	2011-01-20 05:19:41 UTC (rev 55344)
@@ -133,9 +133,9 @@
 	void writeVideoInfo(const Common::String &file, int16 varX, int16 varY,
 			int16 varFrames, int16 varWidth, int16 varHeight);
 
-	bool copyFrame(int slot, byte *dest,
-			uint16 left, uint16 top, uint16 width, uint16 height,
-			uint16 x, uint16 y, uint16 pitch, uint8 bpp = 1, int16 transp = -1) const;
+	bool copyFrame(int slot, Surface &dest,
+			uint16 left, uint16 top, uint16 width, uint16 height, uint16 x, uint16 y,
+			int32 transp = -1) const;
 
 private:
 	struct Video {


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