diff options
author | Paul Gilbert | 2016-10-01 18:12:33 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-10-01 18:12:33 -0400 |
commit | 8befee0dc3c663d61a7af1f6e56634ebf5721d72 (patch) | |
tree | d38a5b7d5432e3e8aa6d3458d0e93fd3d16405f6 /engines/titanic/support | |
parent | e16725a763e560bb4b36c5e19980bf5a1391cb94 (diff) | |
download | scummvm-rg350-8befee0dc3c663d61a7af1f6e56634ebf5721d72.tar.gz scummvm-rg350-8befee0dc3c663d61a7af1f6e56634ebf5721d72.tar.bz2 scummvm-rg350-8befee0dc3c663d61a7af1f6e56634ebf5721d72.zip |
TITANIC: Finished transBlitRect method
Diffstat (limited to 'engines/titanic/support')
-rw-r--r-- | engines/titanic/support/video_surface.cpp | 27 | ||||
-rw-r--r-- | engines/titanic/support/video_surface.h | 2 |
2 files changed, 22 insertions, 7 deletions
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 20b1bb4fbe..60bf45defa 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -163,14 +163,14 @@ void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoS } } -void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src, bool flag) { +void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src, bool flipFlag) { if (lock()) { if (src->lock()) { Graphics::ManagedSurface *srcSurface = src->_rawSurface; Graphics::ManagedSurface *destSurface = _rawSurface; Graphics::Surface destArea = destSurface->getSubArea(destRect); - const uint16 *srcPtr = flag ? + const uint16 *srcPtr = flipFlag ? (const uint16 *)srcSurface->getBasePtr(srcRect.left, srcRect.top) : (const uint16 *)srcSurface->getBasePtr(srcRect.left, srcRect.bottom); uint16 *destPtr = (uint16 *)destSurface->getBasePtr(destArea.w, destArea.h - 1); @@ -179,7 +179,7 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi src->_transparencyMode == TRANS_ALPHA255; CRawSurface rawSurface(src->getTransparencySurface(), src->_transparencyMode); - if (flag) + if (flipFlag) rawSurface.setRow(srcRect.top); else rawSurface.setRow(src->getHeight() - srcRect.bottom); @@ -191,7 +191,8 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi rawSurface.resetPitch(); rawSurface.setCol(srcRect.left); - for (int srcX = 0; srcX < srcRect.width(); ++srcX) { + int srcWidth = srcRect.width(); + while (srcWidth > 0) { int move = rawSurface.moveX(0); if (move <= 1) { @@ -200,13 +201,27 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi is16Bit, isAlpha); } } else { - // TODO + if (move > srcWidth) + move = srcWidth; + + if (rawSurface.isPixelTransparent1()) { + Common::copy(lineSrcP, lineSrcP + move, lineDestP); + } else if (!rawSurface.isPixelTransparent2()) { + byte transVal = rawSurface.getPixel() >> 3; + for (int idx = 0; idx < move; ++idx) { + copyPixel(lineDestP + idx, lineSrcP + idx, transVal, is16Bit, isAlpha); + } + } } + + lineSrcP += move; + lineDestP += move; + srcWidth -= move; } // Move to next line rawSurface.skipPitch(); - srcPtr = flag ? srcPtr + getWidth() : srcPtr - getWidth(); + srcPtr = flipFlag ? srcPtr + getWidth() : srcPtr - getWidth(); destPtr -= destArea.w; } diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index cd87f61292..89d8a03f97 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -53,7 +53,7 @@ private: void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); - void transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src, bool flag); + void transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src, bool flipFlag); protected: static int _videoSurfaceCounter; protected: |