diff options
author | Andrew Kurushin | 2010-10-21 20:13:25 +0000 |
---|---|---|
committer | Andrew Kurushin | 2010-10-21 20:13:25 +0000 |
commit | c1505d6e51d008e2a482f600a960d8fe8e378f75 (patch) | |
tree | 83e9c3f7f4980ae14bec83e4d011ce92bc1ee732 /engines/saga/isomap.cpp | |
parent | f4a0633d8a0f07e456261083a06e3aea4428eb5d (diff) | |
download | scummvm-rg350-c1505d6e51d008e2a482f600a960d8fe8e378f75.tar.gz scummvm-rg350-c1505d6e51d008e2a482f600a960d8fe8e378f75.tar.bz2 scummvm-rg350-c1505d6e51d008e2a482f600a960d8fe8e378f75.zip |
SAGA: unroll IsoMap::drawTile buffer copy loop; refactor Sprite::drawClip
svn-id: r53677
Diffstat (limited to 'engines/saga/isomap.cpp')
-rw-r--r-- | engines/saga/isomap.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/engines/saga/isomap.cpp b/engines/saga/isomap.cpp index 87c49047c5..197055a45d 100644 --- a/engines/saga/isomap.cpp +++ b/engines/saga/isomap.cpp @@ -831,18 +831,30 @@ void IsoMap::drawTile(uint16 tileIndex, const Point &point, const Location *loca widthCount += fgRunCount; count = 0; - while ((col < _tileClip.left) && (count < fgRunCount)) { - count++; - col++; + int colDiff = _tileClip.left - col; + if (colDiff > 0) { + if (colDiff > fgRunCount) { + colDiff = fgRunCount; + } + count = colDiff; + col += colDiff; } - while ((col < _tileClip.right) && (count < fgRunCount)) { - assert(_vm->_gfx->getBackBufferPixels() <= (byte *)(drawPointer + count)); - assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayInfo().width * - _vm->getDisplayInfo().height)) > (byte *)(drawPointer + count)); - drawPointer[count] = readPointer[count]; - count++; - col++; + + colDiff = _tileClip.right - col; + if (colDiff > 0) { + int countDiff = fgRunCount - count; + if (colDiff > countDiff) { + colDiff = countDiff; + } + if (colDiff > 0) { + byte *dst = (byte *)(drawPointer + count); + assert(_vm->_gfx->getBackBufferPixels() <= dst); + assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayInfo().width * _vm->getDisplayInfo().height)) >= (byte *)(dst + colDiff)); + memcpy(dst, (readPointer + count), colDiff); + col += colDiff; + } } + readPointer += fgRunCount; drawPointer += fgRunCount; } |