diff options
author | Paul Gilbert | 2015-05-13 21:24:42 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-05-13 21:24:42 -0400 |
commit | 91d69c7dc151fabdc17b240e525181485c99b807 (patch) | |
tree | 9f9b7000e3bcc4ea2d247f018505e474df3169c7 /engines | |
parent | 24b93a14be56725d65983082592029ee6d24f3c1 (diff) | |
download | scummvm-rg350-91d69c7dc151fabdc17b240e525181485c99b807.tar.gz scummvm-rg350-91d69c7dc151fabdc17b240e525181485c99b807.tar.bz2 scummvm-rg350-91d69c7dc151fabdc17b240e525181485c99b807.zip |
SHERLOCK: Simplify blitFrom methods
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/surface.cpp | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp index 3e82f1dc5b..2dfbdef77f 100644 --- a/engines/sherlock/surface.cpp +++ b/engines/sherlock/surface.cpp @@ -62,28 +62,7 @@ void Surface::blitFrom(const Graphics::Surface &src) { * Draws a surface at a given position within this surface */ void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt) { - Common::Rect drawRect(0, 0, src.w, src.h); - Common::Point destPt = pt; - - if (destPt.x < 0) { - drawRect.left += -destPt.x; - destPt.x = 0; - } - if (destPt.y < 0) { - drawRect.top += -destPt.y; - destPt.y = 0; - } - int right = destPt.x + src.w; - if (right > this->w) { - drawRect.right -= (right - this->w); - } - int bottom = destPt.y + src.h; - if (bottom > this->h) { - drawRect.bottom -= (bottom - this->h); - } - - if (drawRect.isValidRect()) - blitFrom(src, destPt, drawRect); + blitFrom(src, pt, Common::Rect(0, 0, src.w, src.h)); } /** @@ -91,11 +70,10 @@ void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt) { */ void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) { - Common::Rect destRect(pt.x, pt.y, pt.x + srcBounds.width(), - pt.y + srcBounds.height()); Common::Rect srcRect = srcBounds; + Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height()); - if (clip(srcRect, destRect)) { + if (srcRect.isValidRect() && clip(srcRect, destRect)) { // Surface is at least partially or completely on-screen addDirtyRect(destRect); copyRectToSurface(src, destRect.left, destRect.top, srcRect); |