diff options
author | Paul Gilbert | 2015-08-22 18:12:31 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-08-22 18:12:31 -0400 |
commit | 1659e357c2aa3f051cb3baa20bbb0a4282948048 (patch) | |
tree | 4580ab03a41fc9ceb2829f8b3d3aa70bf7c9b650 | |
parent | c0915e95a0112a64c85f909afc8b717357c1c94a (diff) | |
download | scummvm-rg350-1659e357c2aa3f051cb3baa20bbb0a4282948048.tar.gz scummvm-rg350-1659e357c2aa3f051cb3baa20bbb0a4282948048.tar.bz2 scummvm-rg350-1659e357c2aa3f051cb3baa20bbb0a4282948048.zip |
SHERLOCK: RT: Cleanup of sDrawXOffset & sDrawYOffset
-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; } // ******************************************************* |