aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-08-23 10:23:59 -0400
committerPaul Gilbert2015-08-23 10:23:59 -0400
commitb6c996bf9d69d7d4bffcf279bf09250435c35280 (patch)
tree84c751dba9992a193b1ecb622617565696c4e520 /engines
parentc87a73f9fd5ebd6039a17a43c59c661e8b976ca8 (diff)
downloadscummvm-rg350-b6c996bf9d69d7d4bffcf279bf09250435c35280.tar.gz
scummvm-rg350-b6c996bf9d69d7d4bffcf279bf09250435c35280.tar.bz2
scummvm-rg350-b6c996bf9d69d7d4bffcf279bf09250435c35280.zip
SHERLOCK: RT: Fix getting image offsets on unscaled images
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/image_file.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 246b82fa8a..3d881eb655 100644
--- a/engines/sherlock/image_file.cpp
+++ b/engines/sherlock/image_file.cpp
@@ -220,33 +220,37 @@ int ImageFrame::sDrawYSize(int scaleVal) const {
}
int ImageFrame::sDrawXOffset(int scaleVal) const {
- int xOffset = _offset.x;
- if (!scaleVal)
- ++scaleVal;
+ if (scaleVal == SCALE_THRESHOLD)
+ return _offset.x;
- if (scaleVal >= SCALE_THRESHOLD && xOffset)
- --xOffset;
+ int width = _offset.x;
+ int scale = scaleVal == 0 ? 1 : scaleVal;
- xOffset = xOffset * SCALE_THRESHOLD / scaleVal;
if (scaleVal >= SCALE_THRESHOLD)
- ++xOffset;
+ --width;
+
+ int result = width * SCALE_THRESHOLD / scale;
+ if (scaleVal > SCALE_THRESHOLD)
+ ++result;
- return xOffset;
+ return result;
}
int ImageFrame::sDrawYOffset(int scaleVal) const {
- int yOffset = _offset.y;
- if (!scaleVal)
- ++scaleVal;
+ if (scaleVal == SCALE_THRESHOLD)
+ return _offset.y;
- if (scaleVal >= SCALE_THRESHOLD && yOffset)
- --yOffset;
+ int height = _offset.y;
+ int scale = scaleVal == 0 ? 1 : scaleVal;
- yOffset = yOffset * SCALE_THRESHOLD / scaleVal;
if (scaleVal >= SCALE_THRESHOLD)
- ++yOffset;
+ --height;
+
+ int result = height * SCALE_THRESHOLD / scale;
+ if (scaleVal > SCALE_THRESHOLD)
+ ++result;
- return yOffset;
+ return result;
}
// *******************************************************