[Scummvm-cvs-logs] scummvm master -> 2ac05321aab74a4fced53f402f1b0cd16a33cc23

dreammaster dreammaster at scummvm.org
Sat Jun 6 21:38:07 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:
2ac05321aa SHERLOCK: Reverse scaling factor in transBlitFrom to match original


Commit: 2ac05321aab74a4fced53f402f1b0cd16a33cc23
    https://github.com/scummvm/scummvm/commit/2ac05321aab74a4fced53f402f1b0cd16a33cc23
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-06T15:36:23-04:00

Commit Message:
SHERLOCK: Reverse scaling factor in transBlitFrom to match original

Original uses scale amounts > 256 for image reduction, and values
less than that for image expansion

Changed paths:
    engines/sherlock/resources.cpp
    engines/sherlock/surface.cpp
    engines/sherlock/surface.h



diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp
index 0b04d3c..ecc7072 100644
--- a/engines/sherlock/resources.cpp
+++ b/engines/sherlock/resources.cpp
@@ -514,11 +514,11 @@ int ImageFrame::sDrawXSize(int scaleVal) const {
 	int width = _width;
 	int scale = scaleVal == 0 ? 1 : scaleVal;
 
-	if (scaleVal >= 256)
+	if (scaleVal >= SCALE_THRESHOLD)
 		--width;
 
-	int result = width * 256 / scale;
-	if (scaleVal >= 256)
+	int result = width * SCALE_THRESHOLD / scale;
+	if (scaleVal >= SCALE_THRESHOLD)
 		++result;
 
 	return result;
@@ -528,11 +528,11 @@ int ImageFrame::sDrawYSize(int scaleVal) const {
 	int height = _height;
 	int scale = scaleVal == 0 ? 1 : scaleVal;
 
-	if (scaleVal >= 256)
+	if (scaleVal >= SCALE_THRESHOLD)
 		--height;
 
-	int result = height * 256 / scale;
-	if (scaleVal >= 256)
+	int result = height * SCALE_THRESHOLD / scale;
+	if (scaleVal >= SCALE_THRESHOLD)
 		++result;
 
 	return result;
@@ -542,11 +542,11 @@ int ImageFrame::sDrawXOffset(int scaleVal) const {
 	int width = _offset.x;
 	int scale = scaleVal == 0 ? 1 : scaleVal;
 
-	if (scaleVal >= 256)
+	if (scaleVal >= SCALE_THRESHOLD)
 		--width;
 
-	int result = width * 256 / scale;
-	if (scaleVal >= 256)
+	int result = width * SCALE_THRESHOLD / scale;
+	if (scaleVal >= SCALE_THRESHOLD)
 		++result;
 
 	return result;
@@ -556,11 +556,11 @@ int ImageFrame::sDrawYOffset(int scaleVal) const {
 	int height = _offset.y;
 	int scale = scaleVal == 0 ? 1 : scaleVal;
 
-	if (scaleVal >= 256)
+	if (scaleVal >= SCALE_THRESHOLD)
 		--height;
 
-	int result = height * 256 / scale;
-	if (scaleVal >= 256)
+	int result = height * SCALE_THRESHOLD / scale;
+	if (scaleVal >= SCALE_THRESHOLD)
 		++result;
 
 	return result;
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index e456d00..006b31e 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -111,17 +111,16 @@ void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &p
 		return;
 	}
 
-	const int SCALE_LIMIT = 0x100;
-	int scaleX = scaleVal;
-	int scaleY = scaleVal;
+	int scaleX = SCALE_THRESHOLD * SCALE_THRESHOLD / scaleVal;
+	int scaleY = scaleX;
 	int scaleXCtr = 0, scaleYCtr = 0;
 
 	for (int yCtr = 0, destY = pt.y; yCtr < src.h && destY < this->h(); ++yCtr) {
 		// Handle skipping lines if Y scaling
 		scaleYCtr += scaleY;
 		
-		while (scaleYCtr >= SCALE_LIMIT && destY < this->h()) {
-			scaleYCtr -= SCALE_LIMIT;
+		while (scaleYCtr >= SCALE_THRESHOLD && destY < this->h()) {
+			scaleYCtr -= SCALE_THRESHOLD;
 
 			if (destY >= 0) {
 				// Handle drawing the line
@@ -133,8 +132,8 @@ void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &p
 					// Handle horizontal scaling
 					scaleXCtr += scaleX;
 
-					while (scaleXCtr >= SCALE_LIMIT && destX < this->w()) {
-						scaleXCtr -= SCALE_LIMIT;
+					while (scaleXCtr >= SCALE_THRESHOLD && destX < this->w()) {
+						scaleXCtr -= SCALE_THRESHOLD;
 
 						// Only handle on-screen pixels
 						if (destX >= 0 && *pSrc != TRANSPARENCY)
diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h
index 32a674f..94299b4 100644
--- a/engines/sherlock/surface.h
+++ b/engines/sherlock/surface.h
@@ -28,6 +28,8 @@
 
 namespace Sherlock {
 
+#define SCALE_THRESHOLD 0x100
+
 struct ImageFrame;
 
 class Surface {






More information about the Scummvm-git-logs mailing list