From cf664780cb860078f4e06684d862ce4a2c981316 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 14 Sep 2010 09:54:41 +0000 Subject: SWORD25: Bugfix to not draw off-screen images svn-id: r53350 --- engines/sword25/gfx/opengl/glimage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sword25') diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp index f5dac96039..038514ab32 100644 --- a/engines/sword25/gfx/opengl/glimage.cpp +++ b/engines/sword25/gfx/opengl/glimage.cpp @@ -226,13 +226,13 @@ bool GLImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRect, ui // Handle off-screen clipping if (posY < 0) { - img->h -= -posY; + img->h = MAX(0, (int)img->h - -posY); img->pixels = (byte *)img->pixels + img->pitch * -posY; posY = 0; } if (posX < 0) { - img->w -= -posX; + img->w = MAX(0, (int)img->w - -posX); img->pixels = (byte *)img->pixels + (-posX * 4); posX = 0; } -- cgit v1.2.3