diff options
author | Martin Kiewitz | 2010-07-30 22:44:23 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-07-30 22:44:23 +0000 |
commit | 062d9eedce06e79526b478441d2eefe85cf41113 (patch) | |
tree | 4e9b59bc15febfa138353705176d7d300695a5ae /engines/sci | |
parent | 685c124a8e91dcec656258e7d8c11e1a735fe1cf (diff) | |
download | scummvm-rg350-062d9eedce06e79526b478441d2eefe85cf41113.tar.gz scummvm-rg350-062d9eedce06e79526b478441d2eefe85cf41113.tar.bz2 scummvm-rg350-062d9eedce06e79526b478441d2eefe85cf41113.zip |
SCI: fixing view scaling code
fixes crash in sq5 with elevator on goliath
svn-id: r51520
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/view.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index d32e60335f..22deb80422 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -637,7 +637,7 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, uint16 scalingX[640]; uint16 scalingY[480]; int16 scaledWidth, scaledHeight; - int16 pixelNo, scaledPixel, scaledPixelNo, prevScaledPixelNo; + int pixelNo, scaledPixel, scaledPixelNo, prevScaledPixelNo; if (_embeddedPal) { // Merge view palette in... @@ -650,8 +650,8 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, scaledHeight = CLIP<int16>(scaledHeight, 0, _screen->getHeight()); // Do we really need to do this?! - memset(scalingX, 0, sizeof(scalingX)); - memset(scalingY, 0, sizeof(scalingY)); + //memset(scalingX, 0, sizeof(scalingX)); + //memset(scalingY, 0, sizeof(scalingY)); // Create height scaling table pixelNo = 0; @@ -659,16 +659,15 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, while (pixelNo < celHeight) { scaledPixelNo = scaledPixel >> 7; assert(scaledPixelNo < ARRAYSIZE(scalingY)); - if (prevScaledPixelNo < scaledPixelNo) - memset(&scalingY[prevScaledPixelNo], pixelNo, scaledPixelNo - prevScaledPixelNo); - scalingY[scaledPixelNo] = pixelNo; - prevScaledPixelNo = scaledPixelNo + 1; + for (; prevScaledPixelNo <= scaledPixelNo; prevScaledPixelNo++) + scalingY[prevScaledPixelNo] = pixelNo; pixelNo++; scaledPixel += scaleY; } + pixelNo--; scaledPixelNo++; - if (scaledPixelNo < scaledHeight) - memset(&scalingY[scaledPixelNo], pixelNo - 1, scaledHeight - scaledPixelNo); + for (; scaledPixelNo < scaledWidth; scaledPixelNo++) + scalingY[scaledPixelNo] = pixelNo - 1; // Create width scaling table pixelNo = 0; @@ -676,16 +675,15 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, while (pixelNo < celWidth) { scaledPixelNo = scaledPixel >> 7; assert(scaledPixelNo < ARRAYSIZE(scalingX)); - if (prevScaledPixelNo < scaledPixelNo) - memset(&scalingX[prevScaledPixelNo], pixelNo, scaledPixelNo - prevScaledPixelNo); - scalingX[scaledPixelNo] = pixelNo; - prevScaledPixelNo = scaledPixelNo + 1; + for (; prevScaledPixelNo <= scaledPixelNo; prevScaledPixelNo++) + scalingX[prevScaledPixelNo] = pixelNo; pixelNo++; scaledPixel += scaleX; } + pixelNo--; scaledPixelNo++; - if (scaledPixelNo < scaledWidth) - memset(&scalingX[scaledPixelNo], pixelNo - 1, scaledWidth - scaledPixelNo); + for (; scaledPixelNo < scaledWidth; scaledPixelNo++) + scalingX[scaledPixelNo] = pixelNo - 1; scaledWidth = MIN(clipRect.width(), scaledWidth); scaledHeight = MIN(clipRect.height(), scaledHeight); |