[Scummvm-cvs-logs] SF.net SVN: scummvm:[55265] scummvm/trunk/graphics/video/coktel_decoder.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Jan 16 17:41:29 CET 2011


Revision: 55265
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55265&view=rev
Author:   drmccoy
Date:     2011-01-16 16:41:27 +0000 (Sun, 16 Jan 2011)

Log Message:
-----------
VIDEO: Implement internal-codec 24bpp VMDs

Modified Paths:
--------------
    scummvm/trunk/graphics/video/coktel_decoder.cpp

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2011-01-16 16:30:15 UTC (rev 55264)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2011-01-16 16:41:27 UTC (rev 55265)
@@ -2325,8 +2325,43 @@
 }
 
 void VMDDecoder::blit24(const Surface &srcSurf, Common::Rect &rect) {
-	warning("TODO: blit24");
-	return;
+	rect = Common::Rect(rect.left / 3, rect.top, rect.right / 3, rect.bottom);
+
+	Common::Rect srcRect = rect;
+
+	rect.clip(_surface.w, _surface.h);
+
+	PixelFormat pixelFormat = getPixelFormat();
+
+	uint16 x = _x;
+	if (_blitMode == 1)
+		x /= 9;
+
+	const byte *src = (byte *)srcSurf.pixels +
+		(srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel;
+	byte *dst = (byte *)_surface.pixels +
+		((_y + rect.top) * _surface.pitch) + (x + rect.left) * _surface.bytesPerPixel;
+
+	for (int i = 0; i < rect.height(); i++) {
+		const byte *srcRow = src;
+		      byte *dstRow = dst;
+
+		for (int j = 0; j < rect.width(); j++, srcRow += 3, dstRow += _surface.bytesPerPixel) {
+			byte r = srcRow[2];
+			byte g = srcRow[1];
+			byte b = srcRow[0];
+
+			uint32 c = pixelFormat.RGBToColor(r, g, b);
+			if ((r == 0) && (g == 0) && (b == 0))
+				c = 0;
+
+			if (_surface.bytesPerPixel == 2)
+				*((uint16 *)dstRow) = (uint16) c;
+		}
+
+		src += srcSurf .pitch;
+		dst += _surface.pitch;
+	}
 }
 
 void VMDDecoder::emptySoundSlice(uint32 size) {


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