Merge loop limits into one)

svn-id: r18098
This commit is contained in:
Max Horn 2005-05-14 22:55:39 +00:00
parent ef8c36554c
commit 0bb3024467

View File

@ -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])