diff options
author | Johannes Schickel | 2009-06-29 20:17:10 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-06-29 20:17:10 +0000 |
commit | 18940ffd46b93577265b8853979fdbca9b52b3ad (patch) | |
tree | 89af13a15a5297aa3aad0b714bfc4bccb75059d1 | |
parent | a12b4e70024530529c596768e0e33c2896e851a3 (diff) | |
download | scummvm-rg350-18940ffd46b93577265b8853979fdbca9b52b3ad.tar.gz scummvm-rg350-18940ffd46b93577265b8853979fdbca9b52b3ad.tar.bz2 scummvm-rg350-18940ffd46b93577265b8853979fdbca9b52b3ad.zip |
Fix bug in drawShape.
svn-id: r41964
-rw-r--r-- | engines/kyra/screen.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index bb9ce666b8..7f10fb6a5b 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1407,8 +1407,6 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int int t = (flags & 2) ? y2 - y - shapeHeight : y - y1; - const uint8 *s = src; - if (t < 0) { shapeHeight += t; if (shapeHeight <= 0) { @@ -1417,23 +1415,29 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int } t *= -1; - uint8 *tmp = dst; + const uint8 *srcBackUp = 0; do { _dsOffscreenScaleVal1 = 0; + srcBackUp = src; _dsTmpWidth = shapeWidth; + int cnt = shapeWidth; - (this->*_dsScaleSkip)(tmp, s, cnt); + (this->*_dsScaleSkip)(dst, src, cnt); + scaleCounterV += _dsScaleH; - if (!(scaleCounterV & 0xff00)) - continue; - uint8 r = scaleCounterV >> 8; - scaleCounterV &= 0xff; - t -= r; - } while (t > 0); - - if (t < 0) + + if (scaleCounterV & 0xFF00) { + uint8 r = scaleCounterV >> 8; + scaleCounterV &= 0xFF; + t -= r; + } + } while (!(scaleCounterV & 0xFF00) && (t > 0)); + + if (t < 0) { + src = srcBackUp; scaleCounterV += (-t << 8); + } if (!(flags & 2)) y = y1; @@ -1514,28 +1518,28 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int if (!(scaleCounterV & 0xFF00)) { _dsTmpWidth = shapeWidth; int cnt = shapeWidth; - (this->*_dsScaleSkip)(d, s, cnt); + (this->*_dsScaleSkip)(d, src, cnt); } } - const uint8 *b_src = s; + const uint8 *b_src = src; do { - s = b_src; + src = b_src; _dsTmpWidth = shapeWidth; int cnt = _dsOffscreenLeft; - int scaleState = (this->*_dsProcessMargin)(d, s, cnt); + int scaleState = (this->*_dsProcessMargin)(d, src, cnt); if (_dsTmpWidth) { cnt += shpWidthScaled1; if (cnt > 0) { if (flags & 0x800) normalPlot = (curY > _maskMinY && curY < _maskMaxY); _dsPlot = normalPlot ? dsPlot2 : dsPlot3; - (this->*_dsProcessLine)(d, s, cnt, scaleState); + (this->*_dsProcessLine)(d, src, cnt, scaleState); } cnt += _dsOffscreenRight; if (cnt) - (this->*_dsScaleSkip)(d, s, cnt); + (this->*_dsScaleSkip)(d, src, cnt); } dst += dsPitch; d = dst; |