diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/resources.cpp | 24 | ||||
-rw-r--r-- | engines/sherlock/surface.cpp | 13 | ||||
-rw-r--r-- | engines/sherlock/surface.h | 2 |
3 files changed, 20 insertions, 19 deletions
diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp index 0b04d3c3cc..ecc70725d3 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 e456d00e05..006b31ecda 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 32a674fb5b..94299b45cb 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 { |