diff options
author | Borja Lorente | 2016-08-19 15:09:07 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-19 16:30:25 +0200 |
commit | ccd5ad5162652dd3bcc06136ed1917b9f0f0b2ac (patch) | |
tree | 1596434b146c45fa25365d4c3aea4ccd1d78286c /engines/macventure | |
parent | 69f2302a1adb9ead458e38a45429477eac2b6ce4 (diff) | |
download | scummvm-rg350-ccd5ad5162652dd3bcc06136ed1917b9f0f0b2ac.tar.gz scummvm-rg350-ccd5ad5162652dd3bcc06136ed1917b9f0f0b2ac.tar.bz2 scummvm-rg350-ccd5ad5162652dd3bcc06136ed1917b9f0f0b2ac.zip |
MACVENTURE: Fix double overflow when blitting
Diffstat (limited to 'engines/macventure')
-rw-r--r-- | engines/macventure/image.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/engines/macventure/image.cpp b/engines/macventure/image.cpp index aeb5a501a8..172121af0b 100644 --- a/engines/macventure/image.cpp +++ b/engines/macventure/image.cpp @@ -530,27 +530,24 @@ void ImageAsset::calculateSectionToDraw(Graphics::ManagedSurface *target, int &o } void ImageAsset::calculateSectionInDirection(uint targetWhole, uint originWhole, int &originPosition, uint &startPosition, uint &blittedWhole) { + startPosition = 0; blittedWhole = originWhole; - if (originPosition + blittedWhole > targetWhole) { - if (originPosition > (int)targetWhole) { - blittedWhole = 0; - } else { - blittedWhole = (blittedWhole) - ((blittedWhole + originPosition) - targetWhole); - } - } if (originPosition < 0) { if (ABS(originPosition) > (int)blittedWhole) { blittedWhole = 0; } else { blittedWhole -= -originPosition; } - } - - startPosition = 0; - if (originPosition < 0) { startPosition = -originPosition; originPosition = 0; } + if (originPosition + blittedWhole > targetWhole) { + if (originPosition > (int)targetWhole) { + blittedWhole = 0; + } else { + blittedWhole = targetWhole - originPosition; + } + } } } // End of namespace MacVenture |