aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/image.cpp
diff options
context:
space:
mode:
authorBorja Lorente2016-08-19 15:09:07 +0200
committerBorja Lorente2016-08-19 16:30:25 +0200
commitccd5ad5162652dd3bcc06136ed1917b9f0f0b2ac (patch)
tree1596434b146c45fa25365d4c3aea4ccd1d78286c /engines/macventure/image.cpp
parent69f2302a1adb9ead458e38a45429477eac2b6ce4 (diff)
downloadscummvm-rg350-ccd5ad5162652dd3bcc06136ed1917b9f0f0b2ac.tar.gz
scummvm-rg350-ccd5ad5162652dd3bcc06136ed1917b9f0f0b2ac.tar.bz2
scummvm-rg350-ccd5ad5162652dd3bcc06136ed1917b9f0f0b2ac.zip
MACVENTURE: Fix double overflow when blitting
Diffstat (limited to 'engines/macventure/image.cpp')
-rw-r--r--engines/macventure/image.cpp19
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