From 1659e357c2aa3f051cb3baa20bbb0a4282948048 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Aug 2015 18:12:31 -0400 Subject: SHERLOCK: RT: Cleanup of sDrawXOffset & sDrawYOffset --- engines/sherlock/image_file.cpp | 30 ++++++++++++++++-------------- 1 file 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; } // ******************************************************* -- cgit v1.2.3