[Scummvm-cvs-logs] SF.net SVN: scummvm:[45454] scummvm/trunk/engines/scumm/gfx.cpp

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Wed Oct 28 05:57:57 CET 2009


Revision: 45454
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45454&view=rev
Author:   Kirben
Date:     2009-10-28 04:57:54 +0000 (Wed, 28 Oct 2009)

Log Message:
-----------
Fix charset masking for 16bit color games.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/gfx.cpp

Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2009-10-28 00:20:45 UTC (rev 45453)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2009-10-28 04:57:54 UTC (rev 45454)
@@ -635,23 +635,29 @@
 #ifdef USE_ARM_GFX_ASM
 		asmDrawStripToScreen(height, width, text, src, _compositeBuf, vs->pitch, width, _textSurface.pitch);
 #else
-		// We blit four pixels at a time, for improved performance.
-		const uint32 *src32 = (const uint32 *)src;
-		uint32 *dst32 = (uint32 *)_compositeBuf;
+		if (_bytesPerPixel == 2) {
+			const byte *srcPtr = (const byte *)src;
+			const byte *textPtr = (byte *)_textSurface.getBasePtr(x * m, y * m);
+			byte *dstPtr = _compositeBuf;
 
-		vsPitch >>= 2;
-
-		if (_bytesPerPixel == 2) {
-			// Sprites always seem to be used for subtitles in 16Bit color HE games, and not
-			// the charset renderer, so charset masking isn't required.
-			for (int h = height * m; h > 0; --h) {
-				for (int w = width * m; w > 0; w -= 4) {
-					*dst32++ = *src32++;
-					*dst32++ = *src32++;
+			for (int h = 0; h < height * m; ++h) {
+				for (int w = 0; w < width * m; ++w) {
+					uint16 tmp = *textPtr++;
+					if (tmp == CHARSET_MASK_TRANSPARENCY)
+						tmp = READ_UINT16(srcPtr);
+					WRITE_UINT16(dstPtr, tmp); dstPtr += 2;
+					srcPtr += vs->bytesPerPixel;
 				}
-				src32 += vsPitch;
+				srcPtr += vsPitch;
+				textPtr += _textSurface.pitch - width * m;
 			}
 		} else {
+			// We blit four pixels at a time, for improved performance.
+			const uint32 *src32 = (const uint32 *)src;
+			uint32 *dst32 = (uint32 *)_compositeBuf;
+
+			vsPitch >>= 2;
+
 			const uint32 *text32 = (const uint32 *)text;
 			const int textPitch = (_textSurface.pitch - width * m) >> 2;
 			for (int h = height * m; h > 0; --h) {


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