From 4024caf76839a21413317fbb39510a616b958fa5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 23 Aug 2010 23:34:28 +0000 Subject: 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 --- engines/sword25/gfx/opengl/glimage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sword25/gfx') 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; -- cgit v1.2.3