diff options
-rw-r--r-- | engines/sherlock/image_file.cpp | 36 |
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; } // ******************************************************* |