diff options
-rw-r--r-- | engines/sherlock/image_file.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp index 1ff0f4b054..246b82fa8a 100644 --- a/engines/sherlock/image_file.cpp +++ b/engines/sherlock/image_file.cpp @@ -220,31 +220,33 @@ int ImageFrame::sDrawYSize(int scaleVal) const { } int ImageFrame::sDrawXOffset(int scaleVal) const { - int width = _offset.x; - int scale = scaleVal == 0 ? 1 : scaleVal; + int xOffset = _offset.x; + if (!scaleVal) + ++scaleVal; - if (scaleVal >= SCALE_THRESHOLD) - --width; + if (scaleVal >= SCALE_THRESHOLD && xOffset) + --xOffset; - int result = width * SCALE_THRESHOLD / scale; + xOffset = xOffset * SCALE_THRESHOLD / scaleVal; if (scaleVal >= SCALE_THRESHOLD) - ++result; + ++xOffset; - return result; + return xOffset; } int ImageFrame::sDrawYOffset(int scaleVal) const { - int height = _offset.y; - int scale = scaleVal == 0 ? 1 : scaleVal; + int yOffset = _offset.y; + if (!scaleVal) + ++scaleVal; - if (scaleVal >= SCALE_THRESHOLD) - --height; + if (scaleVal >= SCALE_THRESHOLD && yOffset) + --yOffset; - int result = height * SCALE_THRESHOLD / scale; + yOffset = yOffset * SCALE_THRESHOLD / scaleVal; if (scaleVal >= SCALE_THRESHOLD) - ++result; + ++yOffset; - return result; + return yOffset; } // ******************************************************* |