[Scummvm-cvs-logs] scummvm master -> 454bcdc51ce9cf39aaa162140862cfb4e01a2d57

Strangerke Strangerke at scummvm.org
Wed May 25 07:25:56 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
454bcdc51c GNAP: Strengthen sanity checks in drawBitmap


Commit: 454bcdc51ce9cf39aaa162140862cfb4e01a2d57
    https://github.com/scummvm/scummvm/commit/454bcdc51ce9cf39aaa162140862cfb4e01a2d57
Author: Strangerke (strangerke at scummvm.org)
Date: 2016-05-25T07:17:20+02:00

Commit Message:
GNAP: Strengthen sanity checks in drawBitmap

Changed paths:
    engines/gnap/gamesys.cpp



diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp
index bd94558..f4b6c1c 100644
--- a/engines/gnap/gamesys.cpp
+++ b/engines/gnap/gamesys.cpp
@@ -388,25 +388,26 @@ Graphics::Surface *GameSys::loadBitmap(int resourceId) {
 }
 
 void GameSys::drawBitmap(int resourceId) {
+	assert(_backgroundSurface);
+
 	Graphics::Surface *bmpSurface = loadBitmap(resourceId);
-	if (!bmpSurface || !_backgroundSurface) {
-		debugC(kDebugBasic, "GameSys::drawBitmap() Error loading the bitmap");
-		return;
-	}
-	if (bmpSurface->format != _backgroundSurface->format ||
-		bmpSurface->w != _backgroundSurface->w || bmpSurface->h != _backgroundSurface->h) {
-		debugC(kDebugBasic, "GameSys::drawBitmap() Different bitmap properties than current background");
-	} else {
-		byte *src = (byte *)bmpSurface->getPixels();
-		byte *dst = (byte *)_backgroundSurface->getPixels();
-		const int pitch = bmpSurface->pitch;
-		int height = bmpSurface->h;
-		while (height--) {
-			memcpy(dst, src, pitch);
-			src += pitch;
-			dst += pitch;
-		}
+	if (!bmpSurface)
+		error("GameSys::drawBitmap() Error loading the bitmap");
+
+	if (bmpSurface->format != _backgroundSurface->format
+		|| bmpSurface->w != _backgroundSurface->w || bmpSurface->h != _backgroundSurface->h)
+		error("GameSys::drawBitmap() Different bitmap properties than current background");
+
+	byte *src = (byte *)bmpSurface->getPixels();
+	byte *dst = (byte *)_backgroundSurface->getPixels();
+	const int pitch = bmpSurface->pitch;
+	int height = bmpSurface->h;
+	while (height--) {
+		memcpy(dst, src, pitch);
+		src += pitch;
+		dst += pitch;
 	}
+
 	bmpSurface->free();
 	delete bmpSurface;
 






More information about the Scummvm-git-logs mailing list