aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2010-08-23 23:34:28 +0000
committerEugene Sandulenko2010-10-12 23:18:38 +0000
commit4024caf76839a21413317fbb39510a616b958fa5 (patch)
tree7c5893c97e7bb6ab2374086336ec44395e642521
parentedfd2e6aca1063530058800c0253a05eb2588917 (diff)
downloadscummvm-rg350-4024caf76839a21413317fbb39510a616b958fa5.tar.gz
scummvm-rg350-4024caf76839a21413317fbb39510a616b958fa5.tar.bz2
scummvm-rg350-4024caf76839a21413317fbb39510a616b958fa5.zip
SWORD25: Bugfix for clipping error causing crash
The CLIP() macro won't work as desired if the max value is less than the min value. Hence the need for the extra MAX() added into the two lines. svn-id: r53291
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp
index 60b2686051..ec691d8b66 100644
--- a/engines/sword25/gfx/opengl/glimage.cpp
+++ b/engines/sword25/gfx/opengl/glimage.cpp
@@ -196,8 +196,8 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un
PosY = 0;
}
- w = CLIP(w, 0, (int)_backSurface->w - PosX - 1);
- h = CLIP(h, 0, (int)_backSurface->h - PosY - 1);
+ w = CLIP(w, 0, MAX((int)_backSurface->w - PosX - 1, 0));
+ h = CLIP(h, 0, MAX((int)_backSurface->h - PosY - 1, 0));
if (w == 0 || h == 0)
return true;