aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-10-04 19:54:11 -0400
committerPaul Gilbert2016-10-04 19:54:11 -0400
commit1f9b62ee8e560ea06a7cdc102d6509707c498287 (patch)
tree74ee8291cb579e31f096c9199930a2ef6133a631
parent171cf4cc9289633e60e831b43424a7eb8bca6607 (diff)
downloadscummvm-rg350-1f9b62ee8e560ea06a7cdc102d6509707c498287.tar.gz
scummvm-rg350-1f9b62ee8e560ea06a7cdc102d6509707c498287.tar.bz2
scummvm-rg350-1f9b62ee8e560ea06a7cdc102d6509707c498287.zip
TITANIC: Implement blitRect to closer match the original
-rw-r--r--engines/titanic/support/video_surface.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index f596689f19..f88f05327f 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) {