[Scummvm-git-logs] scummvm master -> 1f9b62ee8e560ea06a7cdc102d6509707c498287

dreammaster dreammaster at scummvm.org
Wed Oct 5 01:54:27 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1f9b62ee8e TITANIC: Implement blitRect to closer match the original


Commit: 1f9b62ee8e560ea06a7cdc102d6509707c498287
    https://github.com/scummvm/scummvm/commit/1f9b62ee8e560ea06a7cdc102d6509707c498287
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-10-04T19:54:11-04:00

Commit Message:
TITANIC: Implement blitRect to closer match the original

Changed paths:
    engines/titanic/support/video_surface.cpp



diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index f596689..f88f053 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -161,12 +161,35 @@ void CVideoSurface::blitRect(const Rect &srcRect, const Rect &destRect, CVideoSu
 		_rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top));
 	} else if (src->getTransparencySurface()) {
 		transBlitRect(srcRect, destRect, src, false);
-	} else {
-		_rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, src->getTransparencyColor(), 1);
-	}
+	} else if (lock()) {
+		if (src->lock()) {
+			const Graphics::ManagedSurface *srcSurface = src->_rawSurface;
+			Graphics::ManagedSurface *destSurface = _rawSurface;
+			Graphics::Surface destArea = destSurface->getSubArea(destRect);
+			const uint transColor = src->getTransparencyColor();
 
-	src->unlock();
-	unlock();
+			const uint16 *srcPtr = (const uint16 *)srcSurface->getBasePtr(
+				srcRect.left, srcRect.top);
+			uint16 *destPtr = (uint16 *)destArea.getBasePtr(0, 0);
+
+			for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr,
+				srcPtr += src->getPitch() / 2,
+				destPtr += destArea.pitch / 2) {
+				// Prepare for copying the line
+				const uint16 *lineSrcP = srcPtr;
+				uint16 *lineDestP = destPtr;
+
+				for (int srcX = srcRect.left; srcX < srcRect.right; ++srcX, ++lineSrcP, ++lineDestP) {
+					if (*lineSrcP != transColor)
+						*lineDestP = *lineSrcP;
+				}
+			}
+
+			src->unlock();
+		}
+
+		unlock();
+	}
 }
 
 void CVideoSurface::flippedBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {





More information about the Scummvm-git-logs mailing list