[Scummvm-cvs-logs] scummvm master -> b6c996bf9d69d7d4bffcf279bf09250435c35280

dreammaster dreammaster at scummvm.org
Sun Aug 23 16:24:29 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b6c996bf9d SHERLOCK: RT: Fix getting image offsets on unscaled images


Commit: b6c996bf9d69d7d4bffcf279bf09250435c35280
    https://github.com/scummvm/scummvm/commit/b6c996bf9d69d7d4bffcf279bf09250435c35280
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-23T10:23:59-04:00

Commit Message:
SHERLOCK: RT: Fix getting image offsets on unscaled images

Changed paths:
    engines/sherlock/image_file.cpp



diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 246b82f..3d881eb 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;
 }
 
 // *******************************************************






More information about the Scummvm-git-logs mailing list