diff options
author | Max Horn | 2005-05-14 22:55:39 +0000 |
---|---|---|
committer | Max Horn | 2005-05-14 22:55:39 +0000 |
commit | 0bb3024467c8eb1f74f716848366b9b8fdf6a8c5 (patch) | |
tree | 16fca8847f6ee8dd27f89eeace9771f8fa28ca54 /scumm | |
parent | ef8c36554ce9f3990ee1e21455b9ad9602261457 (diff) | |
download | scummvm-rg350-0bb3024467c8eb1f74f716848366b9b8fdf6a8c5.tar.gz scummvm-rg350-0bb3024467c8eb1f74f716848366b9b8fdf6a8c5.tar.bz2 scummvm-rg350-0bb3024467c8eb1f74f716848366b9b8fdf6a8c5.zip |
Merge loop limits into one)
svn-id: r18098
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/gfx.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 182a90915b..036263afc3 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -1414,9 +1414,17 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi //if (_vm->_NESStartStrip > 0) // stripnr -= _vm->_NESStartStrip; - for (int k = 0; - k < numstrip && sx + k < _numStrips && (x + k) * 8 < MAX(_vm->_roomWidth, (int) vs->w); - ++k, ++stripnr) { + // Compute the number of strips we have to iterate over. + // TODO/FIXME: The computation of its initial value looks very fishy. + // It was added as a kind of hack to fix some corner cases, but it compares + // the room width to the virtual screen width; but the former should always + // be bigger than the latter (except for MM NES, maybe)... strange + int limit = MAX(_vm->_roomWidth, (int) vs->w) / 8 - x; + if (limit > numstrip) + limit = numstrip; + if (limit > _numStrips - sx) + limit = _numStrips - sx; + for (int k = 0; k < limit; ++k, ++stripnr) { CHECK_HEAP; if (y < vs->tdirty[sx + k]) |